summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorewewukek <ewewukek@gmail.com>2024-01-10 23:11:14 +0300
committerewewukek <ewewukek@gmail.com>2024-03-27 13:18:30 +0300
commit55f9902343eff790c420ca3724c02e95664a9d25 (patch)
treee28e36935c70c6f9397f818ed35b6138d36df973 /src/input
parent531cf122d42900453102862caf94119c60d7f077 (diff)
downloadmanaverse-55f9902343eff790c420ca3724c02e95664a9d25.tar.gz
manaverse-55f9902343eff790c420ca3724c02e95664a9d25.tar.bz2
manaverse-55f9902343eff790c420ca3724c02e95664a9d25.tar.xz
manaverse-55f9902343eff790c420ca3724c02e95664a9d25.zip
Add a slider to joystick settings to set axis tolerance
Diffstat (limited to 'src/input')
-rw-r--r--src/input/joystick.cpp6
-rw-r--r--src/input/joystick.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp
index 5396adadc..48b4488b0 100644
--- a/src/input/joystick.cpp
+++ b/src/input/joystick.cpp
@@ -198,12 +198,12 @@ bool Joystick::open()
#ifdef __SWITCH__
config.setValue("joystick" + toString(mNumber) + "calibrated", true);
- config.setValue("joystickTolerance" + toString(mNumber), 10000);
+ config.setValue("joystickTolerance", 10000);
#endif
mCalibrated = config.getValueBool("joystick"
+ toString(mNumber) + "calibrated", false);
- mTolerance = config.getIntValue("joystickTolerance" + toString(mNumber));
+ mTolerance = config.getIntValue("joystickTolerance");
mUseInactive = config.getBoolValue("useInactiveJoystick");
return true;
@@ -341,7 +341,7 @@ void Joystick::finishCalibration()
mCalibrated = true;
mCalibrating = false;
config.setValue("joystick" + toString(mNumber) + "calibrated", true);
- config.setValue("joystickTolerance" + toString(mNumber), mTolerance);
+ config.setValue("joystickTolerance", mTolerance);
}
bool Joystick::buttonPressed(const unsigned char no) const
diff --git a/src/input/joystick.h b/src/input/joystick.h
index 3587d1ba0..198b6fe9e 100644
--- a/src/input/joystick.h
+++ b/src/input/joystick.h
@@ -122,6 +122,9 @@ class Joystick final
int getNumber() const noexcept2 A_WARN_UNUSED
{ return mNumber; }
+ void setTolerance(const int tolerance)
+ { mTolerance = tolerance; }
+
void setUseInactive(const bool b)
{ mUseInactive = b; }