Add missing display server overrides

Improves the base functionality for the Android platform and helps reduce the amount of spurious error logs emitted.
This commit is contained in:
Fredia Huya-Kouadio
2022-11-27 22:03:28 -08:00
parent 4a82d71d73
commit 7cc47613fe
10 changed files with 166 additions and 7 deletions

View File

@@ -619,11 +619,11 @@ MouseButton DisplayServerAndroid::mouse_get_button_state() const {
return (MouseButton)Input::get_singleton()->get_mouse_button_mask();
}
void DisplayServerAndroid::cursor_set_shape(DisplayServer::CursorShape p_shape) {
void DisplayServerAndroid::_cursor_set_shape_helper(CursorShape p_shape, bool force) {
if (!OS_Android::get_singleton()->get_godot_java()->get_godot_view()->can_update_pointer_icon()) {
return;
}
if (cursor_shape == p_shape) {
if (cursor_shape == p_shape && !force) {
return;
}
@@ -634,10 +634,23 @@ void DisplayServerAndroid::cursor_set_shape(DisplayServer::CursorShape p_shape)
}
}
void DisplayServerAndroid::cursor_set_shape(DisplayServer::CursorShape p_shape) {
_cursor_set_shape_helper(p_shape);
}
DisplayServer::CursorShape DisplayServerAndroid::cursor_get_shape() const {
return cursor_shape;
}
void DisplayServerAndroid::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
String cursor_path = p_cursor.is_valid() ? p_cursor->get_path() : "";
if (!cursor_path.is_empty()) {
cursor_path = ProjectSettings::get_singleton()->globalize_path(cursor_path);
}
OS_Android::get_singleton()->get_godot_java()->get_godot_view()->configure_pointer_icon(android_cursors[cursor_shape], cursor_path, p_hotspot);
_cursor_set_shape_helper(p_shape, true);
}
void DisplayServerAndroid::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {
#if defined(VULKAN_ENABLED)
context_vulkan->set_vsync_mode(p_window, p_vsync_mode);
@@ -651,3 +664,23 @@ DisplayServer::VSyncMode DisplayServerAndroid::window_get_vsync_mode(WindowID p_
return DisplayServer::VSYNC_ENABLED;
#endif
}
void DisplayServerAndroid::reset_swap_buffers_flag() {
swap_buffers_flag = false;
}
bool DisplayServerAndroid::should_swap_buffers() const {
return swap_buffers_flag;
}
void DisplayServerAndroid::swap_buffers() {
swap_buffers_flag = true;
}
void DisplayServerAndroid::set_native_icon(const String &p_filename) {
// NOT SUPPORTED
}
void DisplayServerAndroid::set_icon(const Ref<Image> &p_icon) {
// NOT SUPPORTED
}