diff options
-rw-r--r-- | backends/platform/androidsdl/androidsdl-sdl.cpp | 20 | ||||
-rw-r--r-- | backends/platform/androidsdl/androidsdl-sdl.h | 1 | ||||
-rw-r--r-- | common/system.h | 6 | ||||
-rw-r--r-- | gui/options.cpp | 14 | ||||
-rw-r--r-- | gui/options.h | 1 | ||||
-rw-r--r-- | gui/themes/default.inc | 12 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 127241 -> 127377 bytes | |||
-rw-r--r-- | gui/themes/scummclassic/classic_layout.stx | 3 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout_lowres.stx | 3 | ||||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1646781 -> 1646917 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 3 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 3 |
12 files changed, 63 insertions, 3 deletions
diff --git a/backends/platform/androidsdl/androidsdl-sdl.cpp b/backends/platform/androidsdl/androidsdl-sdl.cpp index ab0c0524f1..1492214b58 100644 --- a/backends/platform/androidsdl/androidsdl-sdl.cpp +++ b/backends/platform/androidsdl/androidsdl-sdl.cpp @@ -28,6 +28,7 @@ #include "backends/events/androidsdl/androidsdl-events.h" #include "backends/graphics/androidsdl/androidsdl-graphics.h" #include <SDL_android.h> +#include <SDL_screenkeyboard.h> void OSystem_ANDROIDSDL::initBackend() { // Create the backend custom managers @@ -50,11 +51,25 @@ void OSystem_ANDROIDSDL::initBackend() { } 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 { + showOnScreenControl(ConfMan.getBool("onscreen_control")); + } // Call parent implementation of this method OSystem_POSIX::initBackend(); } +void OSystem_ANDROIDSDL::showOnScreenControl(bool enable) { + if (enable) + SDL_ANDROID_SetScreenKeyboardShown(1); + else + SDL_ANDROID_SetScreenKeyboardShown(0); +} + void OSystem_ANDROIDSDL::touchpadMode(bool enable) { if (enable) switchToRelativeMouseMode(); @@ -72,9 +87,12 @@ void OSystem_ANDROIDSDL::switchToRelativeMouseMode() { void OSystem_ANDROIDSDL::setFeatureState(Feature f, bool enable) { switch (f) { - case kFeatureTouchpadMode: + case kFeatureTouchpadMode: touchpadMode(enable); break; + case kFeatureOnScreenControl: + showOnScreenControl(enable); + break; } OSystem_POSIX::setFeatureState(f, enable); diff --git a/backends/platform/androidsdl/androidsdl-sdl.h b/backends/platform/androidsdl/androidsdl-sdl.h index 72d2a50093..7bc91247bc 100644 --- a/backends/platform/androidsdl/androidsdl-sdl.h +++ b/backends/platform/androidsdl/androidsdl-sdl.h @@ -32,6 +32,7 @@ public: void touchpadMode(bool enable); void switchToDirectMouseMode(); void switchToRelativeMouseMode(); + void showOnScreenControl(bool enable); #ifdef ENABLE_KEYMAPPER // FIXME: This just calls parent methods, is it needed? diff --git a/common/system.h b/common/system.h index 5dd3f68bc0..a481884ea8 100644 --- a/common/system.h +++ b/common/system.h @@ -339,10 +339,14 @@ public: kFeatureOpenUrl #ifdef ANDROIDSDL + , + /** + * show on-screen control + */ + kFeatureOnScreenControl, /** * mouse emulation mode */ - , kFeatureTouchpadMode #endif }; diff --git a/gui/options.cpp b/gui/options.cpp index 30ca132516..4b2765698f 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -138,6 +138,7 @@ OptionsDialog::~OptionsDialog() { void OptionsDialog::init() { #ifdef ANDROIDSDL _enableAndroidSdlSettings = false; + _onscreenCheckbox = 0; _touchpadCheckbox = 0; #endif _enableGraphicSettings = false; @@ -209,6 +210,11 @@ void OptionsDialog::build() { #ifdef ANDROIDSDL // AndroidSDL options + if (ConfMan.hasKey("onscreen_control", _domain)) { + bool onscreenState = ConfMan.getBool("onscreen_control", _domain); + if (_onscreenCheckbox != 0) + _onscreenCheckbox->setState(onscreenState); + } if (ConfMan.hasKey("touchpad_mouse_mode", _domain)) { bool touchpadState = ConfMan.getBool("touchpad_mouse_mode", _domain); if (_touchpadCheckbox != 0) @@ -395,6 +401,10 @@ void OptionsDialog::open() { void OptionsDialog::apply() { #ifdef ANDROIDSDL if (_enableAndroidSdlSettings) { + if (ConfMan.getBool("onscreen_control", _domain) != _onscreenCheckbox->getState()) { + ConfMan.setBool("onscreen_control", _onscreenCheckbox->getState(), _domain); + g_system->setFeatureState(OSystem::kFeatureOnScreenControl, _onscreenCheckbox->getState()); + } if (ConfMan.getBool("touchpad_mouse_mode", _domain) != _touchpadCheckbox->getState()) { ConfMan.setBool("touchpad_mouse_mode", _touchpadCheckbox->getState(), _domain); g_system->setFeatureState(OSystem::kFeatureTouchpadMode, _touchpadCheckbox->getState()); @@ -822,9 +832,11 @@ void OptionsDialog::setSubtitleSettingsState(bool enabled) { #ifdef ANDROIDSDL void OptionsDialog::addAndroidSdlControls(GuiObject *boss, const Common::String &prefix) { + // Show On-Screen control + _onscreenCheckbox = new CheckboxWidget(boss, prefix + "grOnScreenCheckbox", _("Show On-screen control")); // Touchpad Mouse mode _touchpadCheckbox = new CheckboxWidget(boss, prefix + "grTouchpadCheckbox", _("Touchpad mouse mode")); - + _enableAndroidSdlSettings = true; } #endif diff --git a/gui/options.h b/gui/options.h index 046e9acf6d..3189c91982 100644 --- a/gui/options.h +++ b/gui/options.h @@ -123,6 +123,7 @@ private: bool _enableAndroidSdlSettings; CheckboxWidget *_touchpadCheckbox; + CheckboxWidget *_onscreenCheckbox; #endif // diff --git a/gui/themes/default.inc b/gui/themes/default.inc index a83fd788ad..54c63703b0 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -813,6 +813,18 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "</layout>" "</layout>" "</dialog>" + +"<dialog name='GlobalOptions_AndroidSdl' overlays='Dialog.GlobalOptions.TabWidget'>" +"<layout type='vertical' padding='16,16,16,16' spacing='8'>" +"<widget name='grOnScreenCheckbox' " +"type='Checkbox' " +"/>" +"<widget name='grTouchpadCheckbox' " +"type='Checkbox' " +"/>" +"</layout>" +"</dialog>" + "<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>" "<layout type='vertical' padding='16,16,16,16' spacing='8'>" "<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 175a646fd6..733668e5d6 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index d48f208714..f85020824d 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -240,6 +240,9 @@ <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index f58cf76e23..b660b4a8f5 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -237,6 +237,9 @@ <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex 8eb1353e27..1779d22d44 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 4ac032ac67..49fb4813a4 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -254,6 +254,9 @@ <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index f8e56f4083..4a74704c34 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -235,6 +235,9 @@ <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> |