diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 688fb0dbf..b7c5e7d49 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -374,12 +374,19 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window) } axisValue = event.caxis.value; + int deadzone = 0; + + if (event.caxis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + event.caxis.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) + deadzone = DEADZONE_TRIGGERS; + else + deadzone = DEADZONE_THUMBSTICKS; // Check if the input value switched boundaries. - if ((abs(axisValue) > DEADZONE) != (abs(mPrevAxisValues[ - std::make_pair(event.caxis.which, event.caxis.axis)]) > DEADZONE)) { + if ((abs(axisValue) > deadzone) != (abs(mPrevAxisValues[ + std::make_pair(event.caxis.which, event.caxis.axis)]) > deadzone)) { int normValue; - if (abs(axisValue) <= DEADZONE) { + if (abs(axisValue) <= deadzone) { normValue = 0; } else { diff --git a/es-core/src/InputManager.h b/es-core/src/InputManager.h index f4bacd01d..399a21aec 100644 --- a/es-core/src/InputManager.h +++ b/es-core/src/InputManager.h @@ -64,7 +64,8 @@ private: void removeControllerByJoystickID(SDL_JoystickID joyID); static InputManager* sInstance; - static const int DEADZONE = 23000; + static const int DEADZONE_TRIGGERS = 18000; + static const int DEADZONE_THUMBSTICKS = 23000; bool mConfigFileExists; std::map mJoysticks;