1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-21 14:57:09 +00:00

Switch to input buffering on Android

Key, touch and joystick events will be passed directly from the UI thread to Godot, so they can benefit from agile input flushing.

As another consequence of this new way of passing events, less Java object are created at runtime (`Runnable`), which is good since the garbage collector needs to run less.

`AndroidInputHandler` is introduced to have a smaller cross-thread surface. `main_loop_request_go_back()` is removed in favor just inline calling `send_window_event()` at the most caller's convenience (i.e., leveraging the new `p_deferred`` parameter as appropriate).

Lastly, `get_mouse_position()` and `get_mouse_button_state()` now just call through `Input` to avoid the need of sync of mouse data tracked on the UI thread.
This commit is contained in:
Pedro J. Estébanez
2021-08-04 21:22:11 +02:00
parent abdfbef075
commit e745088f1f
11 changed files with 603 additions and 520 deletions

View File

@@ -188,10 +188,6 @@ void OS_Android::main_loop_focusin() {
audio_driver_android.set_pause(false);
}
void OS_Android::main_loop_request_go_back() {
DisplayServerAndroid::get_singleton()->send_window_event(DisplayServer::WINDOW_EVENT_GO_BACK_REQUEST);
}
Error OS_Android::shell_open(String p_uri) {
return godot_io_java->open_uri(p_uri);
}