Mercurial > sdl-ios-xcode
diff src/joystick/SDL_joystick.c @ 2489:96adc8025331 gsoc2008_force_feedback
Exposed some of the joystick stuff to the haptic subsystem.
Added SDL_JoystickIsHaptic().
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Wed, 02 Jul 2008 08:24:35 +0000 |
parents | c121d94672cb |
children | 99210400e8b9 |
line wrap: on
line diff
--- a/src/joystick/SDL_joystick.c Tue Jul 01 18:35:05 2008 +0000 +++ b/src/joystick/SDL_joystick.c Wed Jul 02 08:24:35 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; }