[Scummvm-git-logs] scummvm master -> c8c3a316d67129a29e715233e87bfc6d46c6937f

lephilousophe noreply at scummvm.org
Sat Sep 14 14:52:50 UTC 2024


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:
c8c3a316d6 ANDROID: Properly apply touch settings when starting a game


Commit: c8c3a316d67129a29e715233e87bfc6d46c6937f
    https://github.com/scummvm/scummvm/commit/c8c3a316d67129a29e715233e87bfc6d46c6937f
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-09-14T16:51:19+02:00

Commit Message:
ANDROID: Properly apply touch settings when starting a game

The 2D graphics backend is recycled from the GUI when starting a game.
As a consequence, touch settings were never applied.

Changed paths:
    backends/graphics/android/android-graphics.cpp
    backends/graphics/android/android-graphics.h
    backends/graphics3d/android/android-graphics3d.cpp
    backends/graphics3d/android/android-graphics3d.h
    backends/platform/android/android.cpp


diff --git a/backends/graphics/android/android-graphics.cpp b/backends/graphics/android/android-graphics.cpp
index e0804d43ae2..1fdf5fdcf5e 100644
--- a/backends/graphics/android/android-graphics.cpp
+++ b/backends/graphics/android/android-graphics.cpp
@@ -221,6 +221,11 @@ void AndroidGraphicsManager::refreshScreen() {
 	JNI::swapBuffers();
 }
 
+void AndroidGraphicsManager::applyTouchSettings() const {
+	// not in 3D, maybe in GUI
+	dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(false, _overlayVisible && _overlayInGUI);
+}
+
 void AndroidGraphicsManager::syncVirtkeyboardState(bool virtkeybd_on) {
 	_screenAlign = SCREEN_ALIGN_CENTER;
 	if (virtkeybd_on) {
diff --git a/backends/graphics/android/android-graphics.h b/backends/graphics/android/android-graphics.h
index c865f3cc29b..ab82e0a4743 100644
--- a/backends/graphics/android/android-graphics.h
+++ b/backends/graphics/android/android-graphics.h
@@ -39,6 +39,7 @@ public:
 	virtual bool notifyMousePosition(Common::Point &mouse) = 0;
 
 	virtual void syncVirtkeyboardState(bool virtkeybd_on) = 0;
+	virtual void applyTouchSettings() const = 0;
 
 	/**
 	 * A (subset) of the graphic manager's state. This is used when switching
@@ -104,6 +105,7 @@ protected:
 	void refreshScreen() override;
 
 	void syncVirtkeyboardState(bool virtkeybd_on) override;
+	void applyTouchSettings() const override;
 
 private:
 	OpenGL::Surface *_touchcontrols;
diff --git a/backends/graphics3d/android/android-graphics3d.cpp b/backends/graphics3d/android/android-graphics3d.cpp
index aba80ddafcf..4bda2e3a73f 100644
--- a/backends/graphics3d/android/android-graphics3d.cpp
+++ b/backends/graphics3d/android/android-graphics3d.cpp
@@ -1110,6 +1110,11 @@ void AndroidGraphics3dManager::touchControlDraw(uint8 alpha, int16 x, int16 y, i
 	_touchcontrols_texture->drawTexture(x, y, w, h, clip);
 }
 
+void AndroidGraphics3dManager::applyTouchSettings() const {
+	// in 3D, maybe in GUI
+	dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(true, _show_overlay && _overlay_in_gui);
+}
+
 void AndroidGraphics3dManager::syncVirtkeyboardState(bool virtkeybd_on) {
 	_virtkeybd_on = virtkeybd_on;
 	updateScreenRect();
diff --git a/backends/graphics3d/android/android-graphics3d.h b/backends/graphics3d/android/android-graphics3d.h
index 92f9318abea..0afe53cb583 100644
--- a/backends/graphics3d/android/android-graphics3d.h
+++ b/backends/graphics3d/android/android-graphics3d.h
@@ -126,6 +126,7 @@ public:
 	void touchControlDraw(uint8 alpha, int16 x, int16 y, int16 w, int16 h, const Common::Rect &clip) override;
 
 	void syncVirtkeyboardState(bool virtkeybd_on) override;
+	void applyTouchSettings() const override;
 
 protected:
 	void updateScreenRect();
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index ac0a612f2e8..807f215e3ab 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -576,6 +576,7 @@ void OSystem_Android::initBackend() {
 void OSystem_Android::engineInit() {
 	_engineRunning = true;
 	updateOnScreenControls();
+	dynamic_cast<AndroidCommonGraphics *>(_graphicsManager)->applyTouchSettings();
 
 	JNI::setCurrentGame(ConfMan.getActiveDomainName());
 }




More information about the Scummvm-git-logs mailing list