[Android] Fixes bug 2217, better joystick axes handling on Android.

This commit is contained in:
Gabriel Jacobo 2013-11-11 10:15:35 -03:00
parent 41e8e82847
commit a2cdc5c163
2 changed files with 78 additions and 36 deletions

View file

@ -308,7 +308,10 @@ SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
int
Android_OnPadDown(int padId, int keycode)
{
SDL_PrivateJoystickButton(SYS_Joysticks[padId], keycode_to_SDL(keycode), SDL_PRESSED);
int button = keycode_to_SDL(keycode);
if (button >= 0) {
SDL_PrivateJoystickButton(SYS_Joysticks[padId], button , SDL_PRESSED);
}
return 0;
}
@ -316,7 +319,10 @@ Android_OnPadDown(int padId, int keycode)
int
Android_OnPadUp(int padId, int keycode)
{
SDL_PrivateJoystickButton(SYS_Joysticks[padId], keycode_to_SDL(keycode), SDL_RELEASED);
int button = keycode_to_SDL(keycode);
if (button >= 0) {
SDL_PrivateJoystickButton(SYS_Joysticks[padId], button, SDL_RELEASED);
}
return 0;
}