src/joystick/SDL_gamecontroller.c
changeset 7248 52d3427f8b5a
parent 7247 6a4570f12c20
child 7277 1290cd7f34af
--- 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 )
     {