1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Enable BUTTON_FORWARD and BUTTON_BACK mouse buttons on Android

This commit is contained in:
Fredia Huya-Kouadio
2024-08-12 19:22:36 -07:00
parent a5830f6eb9
commit d1891adced
4 changed files with 13 additions and 23 deletions

View File

@@ -909,15 +909,10 @@ class Godot(private val context: Context) {
}
fun onBackPressed() {
var shouldQuit = true
for (plugin in pluginRegistry.allPlugins) {
if (plugin.onMainBackPressed()) {
shouldQuit = false
}
}
if (shouldQuit) {
renderView?.queueOnRenderThread { GodotLib.back() }
plugin.onMainBackPressed()
}
renderView?.queueOnRenderThread { GodotLib.back() }
}
/**

View File

@@ -154,10 +154,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
}
public boolean onKeyUp(final int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
return false;
}
@@ -183,13 +179,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
}
public boolean onKeyDown(final int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
godot.onBackPressed();
// press 'back' button should not terminate program
//normal handle 'back' event in game logic
return true;
}
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
return false;
}