Add trigger value adjustment code to the SDL_GameControllerGetAxis code as well.

- fixes Trigger values when polling instead of using event driven
This commit is contained in:
Edward Rudd 2013-05-30 22:14:24 -04:00
parent 3d874237bc
commit acb14cfc03

View file

@ -960,7 +960,17 @@ SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControlle
if (gamecontroller->mapping.axes[axis] >= 0 )
{
return ( SDL_JoystickGetAxis( gamecontroller->joystick, gamecontroller->mapping.axes[axis]) );
Sint16 value = ( SDL_JoystickGetAxis( gamecontroller->joystick, gamecontroller->mapping.axes[axis]) );
switch (axis)
{
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
/* Shift it to be 0 - 32767. */
value = value / 2 + 16384;
default:
break;
}
return value;
}
else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 )
{