diff src/joystick/SDL_joystick.c @ 2713:0906692aa6a4

Final merge of Google Summer of Code 2008 work... Force Feedback for SDL by Edgar Simo, mentored by Ryan C. Gordon
author Sam Lantinga <slouken@libsdl.org>
date Mon, 25 Aug 2008 09:55:03 +0000
parents c121d94672cb
children 99210400e8b9
line wrap: on
line diff
--- a/src/joystick/SDL_joystick.c	Mon Aug 25 08:50:37 2008 +0000
+++ b/src/joystick/SDL_joystick.c	Mon Aug 25 09:55:03 2008 +0000
@@ -193,8 +193,12 @@
     return (opened);
 }
 
-static int
-ValidJoystick(SDL_Joystick ** joystick)
+
+/*
+ * Checks to make sure the joystick is valid.
+ */
+int
+SDL_PrivateJoystickValid(SDL_Joystick ** joystick)
 {
     int valid;
 
@@ -216,7 +220,7 @@
 int
 SDL_JoystickIndex(SDL_Joystick * joystick)
 {
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (-1);
     }
     return (joystick->index);
@@ -228,7 +232,7 @@
 int
 SDL_JoystickNumAxes(SDL_Joystick * joystick)
 {
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (-1);
     }
     return (joystick->naxes);
@@ -240,7 +244,7 @@
 int
 SDL_JoystickNumHats(SDL_Joystick * joystick)
 {
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (-1);
     }
     return (joystick->nhats);
@@ -252,7 +256,7 @@
 int
 SDL_JoystickNumBalls(SDL_Joystick * joystick)
 {
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (-1);
     }
     return (joystick->nballs);
@@ -264,7 +268,7 @@
 int
 SDL_JoystickNumButtons(SDL_Joystick * joystick)
 {
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (-1);
     }
     return (joystick->nbuttons);
@@ -278,7 +282,7 @@
 {
     Sint16 state;
 
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (0);
     }
     if (axis < joystick->naxes) {
@@ -298,7 +302,7 @@
 {
     Uint8 state;
 
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (0);
     }
     if (hat < joystick->nhats) {
@@ -318,7 +322,7 @@
 {
     int retval;
 
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (-1);
     }
 
@@ -347,7 +351,7 @@
 {
     Uint8 state;
 
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return (0);
     }
     if (button < joystick->nbuttons) {
@@ -367,7 +371,7 @@
 {
     int i;
 
-    if (!ValidJoystick(&joystick)) {
+    if (!SDL_PrivateJoystickValid(&joystick)) {
         return;
     }