mirror of https://github.com/libsdl-org/SDL
Improved handling of binding buttons and axes
This commit is contained in:
parent
1d956c2817
commit
71f3bf90ed
|
@ -501,7 +501,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_JOYBUTTONUP:
|
||||||
if (event.jbutton.which == nJoystickID) {
|
if (event.jbutton.which == nJoystickID) {
|
||||||
SDL_GameControllerExtendedBind binding;
|
SDL_GameControllerExtendedBind binding;
|
||||||
|
|
||||||
|
@ -544,10 +544,10 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||||
|
|
||||||
SDL_Delay(15);
|
SDL_Delay(15);
|
||||||
|
|
||||||
/* Wait 100 ms for joystick events to stop coming in,
|
/* Wait 30 ms for joystick events to stop coming in,
|
||||||
in case a gamepad sends multiple events for a single control (e.g. axis and button for trigger)
|
in case a gamepad sends multiple events for a single control (e.g. axis and button for trigger)
|
||||||
*/
|
*/
|
||||||
if (s_unPendingAdvanceTime && SDL_GetTicks() - s_unPendingAdvanceTime >= 100) {
|
if (s_unPendingAdvanceTime && SDL_GetTicks() - s_unPendingAdvanceTime >= 30) {
|
||||||
SetCurrentBinding(s_iCurrentBinding + 1);
|
SetCurrentBinding(s_iCurrentBinding + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue