[Scummvm-git-logs] scummvm master -> 536521d356571be803461b8fc74db84e977f23d8
rsn8887
rsn8887 at users.noreply.github.com
Thu Jun 13 22:38:31 CEST 2019
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
536521d356 SWITCH: Enable touchpad mouse mode option in controls
Commit: 536521d356571be803461b8fc74db84e977f23d8
https://github.com/scummvm/scummvm/commit/536521d356571be803461b8fc74db84e977f23d8
Author: rsn8887 (rsn8887 at users.noreply.github.com)
Date: 2019-06-13T15:38:10-05:00
Commit Message:
SWITCH: Enable touchpad mouse mode option in controls
Changed paths:
backends/events/switchsdl/switchsdl-events.cpp
backends/platform/sdl/switch/switch.cpp
backends/platform/sdl/switch/switch.h
diff --git a/backends/events/switchsdl/switchsdl-events.cpp b/backends/events/switchsdl/switchsdl-events.cpp
index 64c2b42..9a42dc3 100644
--- a/backends/events/switchsdl/switchsdl-events.cpp
+++ b/backends/events/switchsdl/switchsdl-events.cpp
@@ -350,7 +350,7 @@ void SwitchEventSource::convertTouchXYToGameXY(float touchX, float touchY, int *
int screenW = _km.x_max;
int windowH = g_system->getHeight();
- //int windowW = g_system->getWidth();
+ int windowW = g_system->getWidth();
bool fullscreen = ConfMan.getBool("fullscreen");
bool aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
@@ -362,33 +362,8 @@ void SwitchEventSource::convertTouchXYToGameXY(float touchX, float touchY, int *
float sx, sy;
float ratio = (float)screenW / (float)screenH;
- if (aspectRatioCorrection && (windowH == 200 || windowH == 400)) {
- ratio = 4.0f / 3.0f;
- }
-
- if (fullscreen || screenH >= dispH) {
- h = dispH;
- if (aspectRatioCorrection && (windowH == 200 || windowH == 400)) {
- ratio = ratio * 1.1f;
- }
- w = h * ratio;
- } else {
- if (screenH <= dispH / 2 && screenW <= dispW / 2) {
- h = screenH * 2;
- w = screenW * 2;
- } else {
- h = screenH;
- w = screenW;
- }
- if (aspectRatioCorrection && (windowH == 200 || windowH == 400)) {
- // stretch the height only if it fits, otherwise make the width smaller
- if (((float)w * (1.0f / ratio)) <= (float)dispH) {
- h = w * (1.0f / ratio);
- } else {
- w = h * ratio;
- }
- }
- }
+ h = dispH;
+ w = h * ratio;
x = (dispW - w) / 2;
y = (dispH - h) / 2;
diff --git a/backends/platform/sdl/switch/switch.cpp b/backends/platform/sdl/switch/switch.cpp
index 77c8d56..ae16f7f 100644
--- a/backends/platform/sdl/switch/switch.cpp
+++ b/backends/platform/sdl/switch/switch.cpp
@@ -89,6 +89,33 @@ void OSystem_Switch::initBackend() {
OSystem_SDL::initBackend();
}
+bool OSystem_Switch::hasFeature(Feature f) {
+ return (f == kFeatureTouchpadMode ||
+ OSystem_SDL::hasFeature(f));
+}
+
+void OSystem_Switch::setFeatureState(Feature f, bool enable) {
+ switch (f) {
+ case kFeatureTouchpadMode:
+ ConfMan.setBool("touchpad_mouse_mode", enable);
+ break;
+ default:
+ OSystem_SDL::setFeatureState(f, enable);
+ break;
+ }
+}
+
+bool OSystem_Switch::getFeatureState(Feature f) {
+ switch (f) {
+ case kFeatureTouchpadMode:
+ return ConfMan.getBool("touchpad_mouse_mode");
+ break;
+ default:
+ return OSystem_SDL::getFeatureState(f);
+ break;
+ }
+}
+
void OSystem_Switch::logMessage(LogMessageType::Type type, const char *message) {
printf("%s\n", message);
}
diff --git a/backends/platform/sdl/switch/switch.h b/backends/platform/sdl/switch/switch.h
index b9e0b06..b9e41e6 100644
--- a/backends/platform/sdl/switch/switch.h
+++ b/backends/platform/sdl/switch/switch.h
@@ -33,6 +33,9 @@ public:
virtual void init() override;
virtual void initBackend() override;
+ virtual bool hasFeature(Feature f) override;
+ virtual void setFeatureState(Feature f, bool enable) override;
+ virtual bool getFeatureState(Feature f) override;
virtual void logMessage(LogMessageType::Type type, const char *message) override;
protected:
More information about the Scummvm-git-logs
mailing list