summaryrefslogtreecommitdiff
path: root/src/input/joystick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/joystick.cpp')
-rw-r--r--src/input/joystick.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp
index 4bcb070d3..0ab6102c5 100644
--- a/src/input/joystick.cpp
+++ b/src/input/joystick.cpp
@@ -195,9 +195,9 @@ bool Joystick::open()
mButtonsNumber = MAX_BUTTONS;
#ifdef __SWITCH__
- config.setValue("joystickTolerance", 10000);
+ config.setValue("joystickTolerance", 0.1F);
#endif
- mTolerance = config.getIntValue("joystickTolerance");
+ mTolerance = config.getFloatValue("joystickTolerance");
mUseInactive = config.getBoolValue("useInactiveJoystick");
return true;
@@ -243,16 +243,16 @@ void Joystick::logic()
{
// X-Axis
int position = SDL_JoystickGetAxis(mJoystick, 0);
- if (position >= mTolerance)
+ if (position >= mTolerance * SDL_JOYSTICK_AXIS_MAX)
mDirection |= RIGHT;
- else if (position <= -mTolerance)
+ else if (position <= mTolerance * SDL_JOYSTICK_AXIS_MIN)
mDirection |= LEFT;
// Y-Axis
position = SDL_JoystickGetAxis(mJoystick, 1);
- if (position <= -mTolerance)
+ if (position <= mTolerance * SDL_JOYSTICK_AXIS_MIN)
mDirection |= UP;
- else if (position >= mTolerance)
+ else if (position >= mTolerance * SDL_JOYSTICK_AXIS_MAX)
mDirection |= DOWN;
#ifdef DEBUG_JOYSTICK