Avoid duplicate joystick axis events
This commit is contained in:
parent
d58b502fad
commit
0273dd1d92
1 changed files with 3 additions and 0 deletions
|
@ -672,6 +672,9 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
|
||||||
joystick->axes[axis].zero = value;
|
joystick->axes[axis].zero = value;
|
||||||
joystick->axes[axis].has_initial_value = SDL_TRUE;
|
joystick->axes[axis].has_initial_value = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
if (value == joystick->axes[axis].value) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (!joystick->axes[axis].sent_initial_value) {
|
if (!joystick->axes[axis].sent_initial_value) {
|
||||||
/* Make sure we don't send motion until there's real activity on this axis */
|
/* Make sure we don't send motion until there's real activity on this axis */
|
||||||
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */
|
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue