summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorewewukek <ewewukek@gmail.com>2024-01-11 13:03:53 +0300
committerFedja Beader <fedja@protonmail.ch>2024-05-15 00:11:38 +0200
commit046ac8fceda89092f01325abbc8d2b5b8602719c (patch)
treec2d2e66ebb263161826fd8dce10162a6d09dc922 /src/gui
parenta9b4edd10420fb35679ee9aac3caa9eb8f35e6dd (diff)
downloadplus-046ac8fceda89092f01325abbc8d2b5b8602719c.tar.gz
plus-046ac8fceda89092f01325abbc8d2b5b8602719c.tar.bz2
plus-046ac8fceda89092f01325abbc8d2b5b8602719c.tar.xz
plus-046ac8fceda89092f01325abbc8d2b5b8602719c.zip
Add a checkbox for d-pad to switch between movement and button behavior
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/tabs/setup_joystick.cpp22
-rw-r--r--src/gui/widgets/tabs/setup_joystick.h1
2 files changed, 18 insertions, 5 deletions
diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp
index c7ece8c7a..860f7a251 100644
--- a/src/gui/widgets/tabs/setup_joystick.cpp
+++ b/src/gui/widgets/tabs/setup_joystick.cpp
@@ -55,6 +55,11 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
false, Modal_false, nullptr, std::string())),
mToleranceLabel(new Label(this)),
mToleranceSlider(new Slider(this, 0.01, 1, 0.01)),
+ mUseHatForMovementCheckBox(new CheckBox(this,
+ // TRANSLATORS: joystick settings tab checkbox
+ _("Use joystick hat (d-pad) for movement"),
+ config.getBoolValue("useHatForMovement"),
+ nullptr, std::string())),
mUseInactiveCheckBox(new CheckBox(this,
// TRANSLATORS: joystick settings tab checkbox
_("Use joystick if client window inactive"),
@@ -106,10 +111,11 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
place(0, 2, mToleranceSlider, 1, 1);
place(1, 2, mToleranceLabel, 1, 1).setPadding(3);
- place(0, 3, mUseInactiveCheckBox, 1, 1);
- place(0, 4, mDetectButton, 1, 1);
+ place(0, 3, mUseHatForMovementCheckBox, 1, 1);
+ place(0, 4, mUseInactiveCheckBox, 1, 1);
+ place(0, 5, mDetectButton, 1, 1);
- setDimension(Rect(0, 0, 365, 60));
+ setDimension(Rect(0, 0, 365, 75));
}
Setup_Joystick::~Setup_Joystick()
@@ -176,8 +182,14 @@ void Setup_Joystick::apply()
config.setValue("joystickEnabled", Joystick::isEnabled());
- config.setValue("useInactiveJoystick", mUseInactiveCheckBox->isSelected());
- joystick->setUseInactive(mUseInactiveCheckBox->isSelected());
+ config.setValue("useHatForMovement",
+ mUseHatForMovementCheckBox->isSelected());
+ joystick->setUseHatForMovement(
+ mUseHatForMovementCheckBox->isSelected());
+ config.setValue("useInactiveJoystick",
+ mUseInactiveCheckBox->isSelected());
+ joystick->setUseInactive(
+ mUseInactiveCheckBox->isSelected());
float tolerance = mToleranceSlider->getValue();
config.setValue("joystickTolerance", tolerance);
diff --git a/src/gui/widgets/tabs/setup_joystick.h b/src/gui/widgets/tabs/setup_joystick.h
index fce59a02c..2c138daf5 100644
--- a/src/gui/widgets/tabs/setup_joystick.h
+++ b/src/gui/widgets/tabs/setup_joystick.h
@@ -57,6 +57,7 @@ class Setup_Joystick final : public SetupTab
DropDown *mNamesDropDown A_NONNULLPOINTER;
Label *mToleranceLabel A_NONNULLPOINTER;
Slider *mToleranceSlider A_NONNULLPOINTER;
+ CheckBox *mUseHatForMovementCheckBox A_NONNULLPOINTER;
CheckBox *mUseInactiveCheckBox A_NONNULLPOINTER;
bool mOriginalJoystickEnabled A_NONNULLPOINTER;
};