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

Add support for pointer capture

This commit is contained in:
Fredia Huya-Kouadio
2022-10-20 07:16:29 -07:00
parent 92aedd5063
commit 5149311316
12 changed files with 205 additions and 48 deletions

View File

@@ -274,10 +274,10 @@ Error OS_Android::open_dynamic_library(const String p_path, void *&p_library_han
}
void OS_Android::set_mouse_mode(MouseMode p_mode) {
if (!godot_java->get_godot_view()->can_update_pointer_icon()) {
if (!godot_java->get_godot_view()->can_update_pointer_icon() || !godot_java->get_godot_view()->can_capture_pointer()) {
return;
}
if (mouse_mode == p_mode || p_mode == MouseMode::MOUSE_MODE_CAPTURED) {
if (mouse_mode == p_mode) {
return;
}
@@ -287,6 +287,12 @@ void OS_Android::set_mouse_mode(MouseMode p_mode) {
set_cursor_shape(cursor_shape);
}
if (p_mode == MouseMode::MOUSE_MODE_CAPTURED) {
godot_java->get_godot_view()->request_pointer_capture();
} else {
godot_java->get_godot_view()->release_pointer_capture();
}
mouse_mode = p_mode;
}