From 97a698a554adf3e4f7991227c634b934d294d42e Mon Sep 17 00:00:00 2001 From: Dries Harnie Date: Thu, 23 May 2013 20:54:07 +0200 Subject: [PATCH] ANDROID: Add kVirtControls to OSystem_Android --- backends/platform/android/android.cpp | 7 +++++++ backends/platform/android/android.h | 1 + backends/platform/android/events.cpp | 6 +++--- common/system.h | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 08e2d9c5162..99d7fc10581 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -134,6 +134,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) : _show_mouse(false), _show_overlay(false), _virt_arrowkeys_pressed(false), + _virtcontrols_on(false), _enable_zoning(false), _mixer(0), _shake_offset(0), @@ -409,6 +410,7 @@ bool OSystem_Android::hasFeature(Feature f) { f == kFeatureAspectRatioCorrection || f == kFeatureCursorPalette || f == kFeatureVirtualKeyboard || + f == kFeatureVirtControls || #ifdef USE_OPENGL f == kFeatureOpenGL || #endif @@ -431,6 +433,9 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) { _virtkeybd_on = enable; showVirtualKeyboard(enable); break; + case kFeatureVirtControls: + _virtcontrols_on = enable; + break; case kFeatureCursorPalette: _use_mouse_palette = enable; if (!enable) @@ -449,6 +454,8 @@ bool OSystem_Android::getFeatureState(Feature f) { return _ar_correction; case kFeatureVirtualKeyboard: return _virtkeybd_on; + case kFeatureVirtControls: + return _virtcontrols_on; case kFeatureCursorPalette: return _use_mouse_palette; default: diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index fba5aaca285..5e746da5624 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -140,6 +140,7 @@ private: bool _show_mouse; bool _use_mouse_palette; + bool _virtcontrols_on; int _virt_arrowkeys_pressed; int _graphicsMode; diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 980c649b2d1..ef9ca99fa10 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -748,7 +748,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, return; } - if (_show_mouse) { + if (!_virtcontrols_on) { e.type = Common::EVENT_MOUSEMOVE; if (_touchpad_mode) { @@ -881,7 +881,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, switch (arg2) { case JACTION_DOWN: case JACTION_MULTIPLE: - if (!_show_mouse) { + if (_virtcontrols_on) { checkVirtArrowKeys(arg1, arg2, arg3, arg4, arg5, arg6); } return; @@ -894,7 +894,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, if (arg1 > _fingersDown) _fingersDown = arg1; - if (!_show_mouse) { + if (_virtcontrols_on) { checkVirtArrowKeys(arg1, arg2, arg3, arg4, arg5, arg6); } diff --git a/common/system.h b/common/system.h index 38636fa616d..22b955d840b 100644 --- a/common/system.h +++ b/common/system.h @@ -312,6 +312,7 @@ public: //ResidualVM specific kFeatureOpenGL, + kFeatureVirtControls, /** * The presence of this feature indicates whether the displayLogFile()