diff options
Diffstat (limited to 'src/input/joystick.cpp')
-rw-r--r-- | src/input/joystick.cpp | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 48b4488b0..4bcb070d3 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -49,9 +49,7 @@ Joystick::Joystick(const int no) : mDirection(0), mJoystick(nullptr), mTolerance(0), - mCalibrating(false), mNumber(no >= joystickCount ? joystickCount : no), - mCalibrated(false), mButtonsNumber(MAX_BUTTONS), mUseInactive(false), mHaveHats(false), @@ -197,12 +195,8 @@ bool Joystick::open() mButtonsNumber = MAX_BUTTONS; #ifdef __SWITCH__ - config.setValue("joystick" + toString(mNumber) + "calibrated", true); config.setValue("joystickTolerance", 10000); #endif - mCalibrated = config.getValueBool("joystick" - + toString(mNumber) + "calibrated", false); - mTolerance = config.getIntValue("joystickTolerance"); mUseInactive = config.getBoolValue("useInactiveJoystick"); @@ -236,15 +230,7 @@ void Joystick::setNumber(const int n) void Joystick::logic() { BLOCK_START("Joystick::logic") - // When calibrating, don't bother the outside with our state - if (mCalibrating) - { - doCalibration(); - BLOCK_END("Joystick::logic") - return; - } - - if (!mEnabled || !mCalibrated) + if (!mEnabled) { BLOCK_END("Joystick::logic") return; @@ -313,37 +299,6 @@ void Joystick::logic() BLOCK_END("Joystick::logic") } -void Joystick::startCalibration() -{ - mTolerance = 0; - mCalibrating = true; -} - -void Joystick::doCalibration() -{ - // X-Axis - int position = SDL_JoystickGetAxis(mJoystick, 0); - if (position > mTolerance) - mTolerance = position; - else if (position < -mTolerance) - mTolerance = -position; - - // Y-Axis - position = SDL_JoystickGetAxis(mJoystick, 1); - if (position > mTolerance) - mTolerance = position; - else if (position < -mTolerance) - mTolerance = -position; -} - -void Joystick::finishCalibration() -{ - mCalibrated = true; - mCalibrating = false; - config.setValue("joystick" + toString(mNumber) + "calibrated", true); - config.setValue("joystickTolerance", mTolerance); -} - bool Joystick::buttonPressed(const unsigned char no) const { return (mEnabled && no < MAX_BUTTONS) ? mActiveButtons[no] : false; @@ -414,7 +369,7 @@ bool Joystick::isActionActive(const InputActionT index) const bool Joystick::validate() const { - if (mCalibrating || !mEnabled || !mCalibrated) + if (!mEnabled) return false; return mUseInactive || |