mirror of https://github.com/stella-emu/stella.git
added analog input filtering in UI (fixes #578)
This commit is contained in:
parent
97f6271412
commit
f9de0deee7
|
@ -33,6 +33,8 @@
|
|||
|
||||
* Added that mouse sensitivity for Driving controller can be adjusted
|
||||
|
||||
* Added paddle filtering in UI to avoid unwanted navigation events
|
||||
|
||||
* Added selectable dialog fonts
|
||||
|
||||
* Added separate positioning of launcher, emulator and debugger
|
||||
|
|
|
@ -687,27 +687,32 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
|||
}
|
||||
j->axisLastValue[axis] = value;
|
||||
}
|
||||
#ifdef GUI_SUPPORT
|
||||
else if(myHandler.hasOverlay())
|
||||
{
|
||||
// First, clamp the values to simulate digital input
|
||||
// (the only thing that the underlying code understands)
|
||||
if(value > Joystick::deadzone())
|
||||
value = 32000;
|
||||
else if(value < -Joystick::deadzone())
|
||||
value = -32000;
|
||||
else
|
||||
value = 0;
|
||||
|
||||
// Now filter out consecutive, similar values
|
||||
// (only pass on the event if the state has changed)
|
||||
if(value != j->axisLastValue[axis])
|
||||
// A value change lower than Joystick::deadzone indicates analog input which is ignored
|
||||
if((abs(j->axisLastValue[axis] - value) > Joystick::deadzone()))
|
||||
{
|
||||
#ifdef GUI_SUPPORT
|
||||
myHandler.overlay().handleJoyAxisEvent(stick, JoyAxis(axis), convertAxisValue(value), button);
|
||||
#endif
|
||||
j->axisLastValue[axis] = value;
|
||||
// First, clamp the values to simulate digital input
|
||||
// (the only thing that the underlying code understands)
|
||||
if(value > Joystick::deadzone())
|
||||
value = 32000;
|
||||
else if(value < -Joystick::deadzone())
|
||||
value = -32000;
|
||||
else
|
||||
value = 0;
|
||||
|
||||
// Now filter out consecutive, similar values
|
||||
// (only pass on the event if the state has changed)
|
||||
if(value != j->axisLastValue[axis])
|
||||
{
|
||||
myHandler.overlay().handleJoyAxisEvent(stick, JoyAxis(axis), convertAxisValue(value), button);
|
||||
|
||||
}
|
||||
}
|
||||
j->axisLastValue[axis] = value;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue