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:
parent
3d874237bc
commit
acb14cfc03
1 changed files with 11 additions and 1 deletions
|
@ -960,7 +960,17 @@ SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControlle
|
||||||
|
|
||||||
if (gamecontroller->mapping.axes[axis] >= 0 )
|
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 )
|
else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue