fix for #552 (analog/digital part) (TODO: test!)

This commit is contained in:
Thomas Jentzsch 2019-12-23 17:08:51 +01:00
parent 5a283a0140
commit cdf2ad1e13
1 changed files with 4 additions and 3 deletions

View File

@ -615,12 +615,13 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
if(myHandler.state() == EventHandlerState::EMULATION)
{
Event::Type eventAxisAnalog;
// Check for analog events, which are handled differently
// A value change lower than ~90% indicates analog input
if(abs(j->axisLastValue[axis] - value) < 30000)
if((abs(j->axisLastValue[axis] - value) < 30000)
&& (eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG)) != Event::Type::NoType)
{
Event::Type eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG);
myHandler.handleEvent(eventAxisAnalog, value);
}
else