aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorlubomyr2017-02-14 17:38:44 +0200
committerlubomyr2017-02-14 17:38:44 +0200
commit2412502eee900208fe9d53f4ba99efb2dc357b6e (patch)
treea58af74f886a35b11d93b0323ee6d4ab9fbaf8bb /backends
parent216f9c4f11cd95f9e4ed049c9ecc97304e83f837 (diff)
downloadscummvm-rg350-2412502eee900208fe9d53f4ba99efb2dc357b6e.tar.gz
scummvm-rg350-2412502eee900208fe9d53f4ba99efb2dc357b6e.tar.bz2
scummvm-rg350-2412502eee900208fe9d53f4ba99efb2dc357b6e.zip
ANDROIDSDL: implemented checkbox for swap menu and back buttons
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/androidsdl/androidsdl-sdl.cpp31
-rw-r--r--backends/platform/androidsdl/androidsdl-sdl.h1
2 files changed, 28 insertions, 4 deletions
diff --git a/backends/platform/androidsdl/androidsdl-sdl.cpp b/backends/platform/androidsdl/androidsdl-sdl.cpp
index 61b01920bb..f841426a9d 100644
--- a/backends/platform/androidsdl/androidsdl-sdl.cpp
+++ b/backends/platform/androidsdl/androidsdl-sdl.cpp
@@ -45,19 +45,22 @@ void OSystem_ANDROIDSDL::initBackend() {
if (!ConfMan.hasKey("gfx_mode"))
ConfMan.set("gfx_mode", "2x");
+ if (!ConfMan.hasKey("swap_menu_and_back"))
+ ConfMan.setBool("swap_menu_and_back", true);
+ else
+ swapMenuAndBackButtons(ConfMan.getBool("swap_menu_and_back"));
+
if (!ConfMan.hasKey("touchpad_mouse_mode")) {
const bool enable = (SDL_ANDROID_GetMouseEmulationMode() == 0) ? false : true;
ConfMan.setBool("touchpad_mouse_mode", enable);
- } else {
+ } else
touchpadMode(ConfMan.getBool("touchpad_mouse_mode"));
- }
if (!ConfMan.hasKey("onscreen_control")) {
const bool enable = (SDL_ANDROID_GetScreenKeyboardShown() == 0) ? false : true;
ConfMan.setBool("onscreen_control", enable);
- } else {
+ } else
showOnScreenControl(ConfMan.getBool("onscreen_control"));
- }
// Call parent implementation of this method
OSystem_POSIX::initBackend();
@@ -77,6 +80,18 @@ void OSystem_ANDROIDSDL::touchpadMode(bool enable) {
switchToDirectMouseMode();
}
+void OSystem_ANDROIDSDL::swapMenuAndBackButtons(bool enable) {
+ static int KEYCODE_MENU = 82;
+ static int KEYCODE_BACK = 4;
+ if (enable) {
+ SDL_ANDROID_SetAndroidKeycode(KEYCODE_BACK, SDLK_F13);
+ SDL_ANDROID_SetAndroidKeycode(KEYCODE_MENU, SDLK_ESCAPE);
+ } else {
+ SDL_ANDROID_SetAndroidKeycode(KEYCODE_BACK, SDLK_ESCAPE);
+ SDL_ANDROID_SetAndroidKeycode(KEYCODE_MENU, SDLK_F13);
+ }
+}
+
void OSystem_ANDROIDSDL::switchToDirectMouseMode() {
SDL_ANDROID_SetMouseEmulationMode(0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
}
@@ -95,6 +110,10 @@ void OSystem_ANDROIDSDL::setFeatureState(Feature f, bool enable) {
ConfMan.setBool("onscreen_control", enable);
showOnScreenControl(enable);
break;
+ case kFeatureSwapMenuAndBackButtons:
+ ConfMan.setBool("swap_menu_and_back", enable);
+ swapMenuAndBackButtons(enable);
+ break;
}
OSystem_POSIX::setFeatureState(f, enable);
@@ -108,6 +127,9 @@ bool OSystem_ANDROIDSDL::getFeatureState(Feature f) {
case kFeatureOnScreenControl:
return ConfMan.getBool("onscreen_control");
break;
+ case kFeatureSwapMenuAndBackButtons:
+ return ConfMan.getBool("swap_menu_and_back");
+ break;
default:
return OSystem_POSIX::getFeatureState(f);
break;
@@ -117,5 +139,6 @@ bool OSystem_ANDROIDSDL::getFeatureState(Feature f) {
bool OSystem_ANDROIDSDL::hasFeature(Feature f) {
return (f == kFeatureTouchpadMode ||
f == kFeatureOnScreenControl ||
+ f == kFeatureSwapMenuAndBackButtons ||
f == OSystem_POSIX::getFeatureState(f));
}
diff --git a/backends/platform/androidsdl/androidsdl-sdl.h b/backends/platform/androidsdl/androidsdl-sdl.h
index 4976e320df..e83f610d10 100644
--- a/backends/platform/androidsdl/androidsdl-sdl.h
+++ b/backends/platform/androidsdl/androidsdl-sdl.h
@@ -32,6 +32,7 @@ public:
virtual bool getFeatureState(Feature f);
virtual bool hasFeature(Feature f);
void touchpadMode(bool enable);
+ void swapMenuAndBackButtons(bool enable);
void switchToDirectMouseMode();
void switchToRelativeMouseMode();
void showOnScreenControl(bool enable);