From 618eb27e8b1d3a00fd5a809a0a998d4e0f10e1b7 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 22 Jul 2021 19:23:48 +0300 Subject: Move `alert` function from `DisplayServer` to `OS`. --- platform/javascript/display_server_javascript.cpp | 4 ---- platform/javascript/display_server_javascript.h | 1 - platform/javascript/os_javascript.cpp | 4 ++++ platform/javascript/os_javascript.h | 3 +++ 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'platform/javascript') diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index 5e2b089c7f..8df81bb8cc 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -659,10 +659,6 @@ void DisplayServerJavaScript::send_window_event_callback(int p_notification) { } } -void DisplayServerJavaScript::alert(const String &p_alert, const String &p_title) { - godot_js_display_alert(p_alert.utf8().get_data()); -} - void DisplayServerJavaScript::set_icon(const Ref &p_icon) { ERR_FAIL_COND(p_icon.is_null()); Ref icon = p_icon; diff --git a/platform/javascript/display_server_javascript.h b/platform/javascript/display_server_javascript.h index f8acf30854..bf5e229c9a 100644 --- a/platform/javascript/display_server_javascript.h +++ b/platform/javascript/display_server_javascript.h @@ -109,7 +109,6 @@ public: bool check_size_force_redraw(); // from DisplayServer - virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override; virtual bool has_feature(Feature p_feature) const override; virtual String get_name() const override; diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 260bfad7a5..549c1d47ec 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -47,6 +47,10 @@ #include "godot_js.h" +void OS_JavaScript::alert(const String &p_alert, const String &p_title) { + godot_js_display_alert(p_alert.utf8().get_data()); +} + // Lifecycle void OS_JavaScript::initialize() { OS_Unix::initialize_core(); diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 81bb9c5f3d..efac2dbca7 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -89,6 +89,9 @@ public: String get_user_data_dir() const override; bool is_userfs_persistent() const override; + + void alert(const String &p_alert, const String &p_title = "ALERT!") override; + Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) override; void resume_audio(); -- cgit v1.2.3