summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorcpasjuste <cpasjuste@gmail.com>2020-04-22 18:19:18 +0200
committercpasjuste <cpasjuste@gmail.com>2020-04-22 18:19:18 +0200
commiteeb40fb079971ece6288e5210e42a9cc3fc95790 (patch)
tree0c9a1e45861dbdec7a344b6280831527f71f5ca2 /src/input
parentf43e3aa48aeb561f5c7e85f1b7121aab6a61decd (diff)
downloadmv-eeb40fb079971ece6288e5210e42a9cc3fc95790.tar.gz
mv-eeb40fb079971ece6288e5210e42a9cc3fc95790.tar.bz2
mv-eeb40fb079971ece6288e5210e42a9cc3fc95790.tar.xz
mv-eeb40fb079971ece6288e5210e42a9cc3fc95790.zip
switch: enable joystick and mouse
Diffstat (limited to 'src/input')
-rw-r--r--src/input/inputmanager.cpp3
-rw-r--r--src/input/joystick.cpp9
2 files changed, 12 insertions, 0 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index b470b66ac..f6e24f904 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -88,6 +88,9 @@ InputManager::InputManager() :
void InputManager::init() restrict2
{
+#ifdef __SWITCH__
+ SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "1");
+#endif
for (size_t i = 0;
i < CAST_SIZE(InputAction::TOTAL);
i ++)
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp
index 1492ba09b..34f2619b9 100644
--- a/src/input/joystick.cpp
+++ b/src/input/joystick.cpp
@@ -177,8 +177,17 @@ bool Joystick::open()
if (mButtonsNumber > MAX_BUTTONS)
mButtonsNumber = MAX_BUTTONS;
+#ifdef __SWITCH__
+ config.setValue("joystick" + toString(mNumber) + "calibrated", true);
+ config.setValue("leftTolerance" + toString(mNumber), 100);
+ config.setValue("rightTolerance" + toString(mNumber), 100);
+ config.setValue("upTolerance" + toString(mNumber), 100);
+ config.setValue("downTolerance" + toString(mNumber), 100);
+ config.setValue("useInactiveJoystick", true);
+#endif
mCalibrated = config.getValueBool("joystick"
+ toString(mNumber) + "calibrated", false);
+
mUpTolerance = config.getIntValue("upTolerance" + toString(mNumber));
mDownTolerance = config.getIntValue("downTolerance" + toString(mNumber));
mLeftTolerance = config.getIntValue("leftTolerance" + toString(mNumber));