mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added separate controller deadzone values for the triggers and thumbsticks.
This commit is contained in:
parent
4dc6355a34
commit
3185083ca5
|
@ -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 {
|
||||
|
|
|
@ -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<SDL_JoystickID, SDL_Joystick*> mJoysticks;
|
||||
|
|
Loading…
Reference in a new issue