Add trigger value adjustment code to the SDL_GameControllerGetAxis code as well.
- fixes Trigger values when polling instead of using event driven
--- a/src/joystick/SDL_gamecontroller.c Thu May 30 10:42:52 2013 -0400
+++ b/src/joystick/SDL_gamecontroller.c Thu May 30 22:14:24 2013 -0400
@@ -960,7 +960,17 @@
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 )
{