mirror of
https://github.com/yawut/SDL.git
synced 2026-08-20 07:44:03 -05:00
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:
@@ -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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user