summaryrefslogtreecommitdiff
path: root/src
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
parentf43e3aa48aeb561f5c7e85f1b7121aab6a61decd (diff)
downloadmanaplus-eeb40fb079971ece6288e5210e42a9cc3fc95790.tar.gz
manaplus-eeb40fb079971ece6288e5210e42a9cc3fc95790.tar.bz2
manaplus-eeb40fb079971ece6288e5210e42a9cc3fc95790.tar.xz
manaplus-eeb40fb079971ece6288e5210e42a9cc3fc95790.zip
switch: enable joystick and mouse
Diffstat (limited to 'src')
-rw-r--r--src/defaults.cpp4
-rw-r--r--src/graphicsmanager.cpp3
-rw-r--r--src/input/inputmanager.cpp3
-rw-r--r--src/input/joystick.cpp9
4 files changed, 19 insertions, 0 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 0907e15d7..794e5698c 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -176,7 +176,11 @@ void setConfigDefaults(Configuration &cfg)
AddDEF("screenshotDirectory3", "");
AddDEF("useScreenshotDirectorySuffix", true);
AddDEF("screenshotDirectorySuffix", "");
+#ifdef __SWITCH__
+ AddDEF("joystickEnabled", true);
+#else
AddDEF("joystickEnabled", false);
+#endif
AddDEF("upTolerance", 100);
AddDEF("downTolerance", 100);
AddDEF("leftTolerance", 100);
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 4a5035909..2bdfdac43 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -481,6 +481,9 @@ void GraphicsManager::setVideoMode()
int width = info->current_w;
int height = info->current_h;
#endif // USE_SDL2
+#elif defined __SWITCH__
+ int width = 1280;
+ int height = 720;
#else // defined __native_client__
int width = config.getIntValue("screenwidth");
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));