From 16ef890cb478c8b9df9fe47ec3ad174694acc6cf Mon Sep 17 00:00:00 2001 From: Caroline Joy Bell Date: Sat, 9 Mar 2024 00:50:40 -0600 Subject: [PATCH] Return a real video mode Rather than a new fake one every time --- os_switch.cpp | 19 ++++++++++++++----- os_switch.h | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/os_switch.cpp b/os_switch.cpp index 9973af0..4e86d94 100644 --- a/os_switch.cpp +++ b/os_switch.cpp @@ -152,7 +152,7 @@ Error OS_Switch::initialize(const VideoMode &p_desired, int p_video_driver, int video_driver_index = p_video_driver; - gl_context->set_use_vsync(current_videomode.use_vsync); + gl_context->set_use_vsync(video_mode.use_vsync); #endif visual_server = memnew(VisualServerRaster); @@ -230,12 +230,16 @@ int OS_Switch::get_mouse_button_state() const { void OS_Switch::set_window_title(const String &p_title) {} -void OS_Switch::set_video_mode(const OS::VideoMode &p_video_mode, int p_screen) {} +void OS_Switch::set_video_mode(const OS::VideoMode &p_video_mode, int p_screen) { + video_mode = p_video_mode; +} OS::VideoMode OS_Switch::get_video_mode(int p_screen) const { - return VideoMode(1280, 720); + return video_mode; } -void OS_Switch::get_fullscreen_mode_list(List *p_list, int p_screen) const {} +void OS_Switch::get_fullscreen_mode_list(List *p_list, int p_screen) const { + p_list->push_back(video_mode); +} OS::RenderThreadMode OS_Switch::get_render_thread_mode() const { if (OS::get_render_thread_mode() == OS::RenderThreadMode::RENDER_SEPARATE_THREAD) { @@ -248,7 +252,7 @@ int OS_Switch::get_current_video_driver() const { return video_driver_index; } Size2 OS_Switch::get_window_size() const { - return Size2(1280, 720); + return Size2(video_mode.width, video_mode.height); } Error OS_Switch::execute(const String &p_path, const List &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex, bool p_open_console) { @@ -577,6 +581,11 @@ OS_Switch *OS_Switch::get_singleton() { }; OS_Switch::OS_Switch() { + video_mode.width = 1280; + video_mode.height = 720; + video_mode.fullscreen = true; + video_mode.resizable = false; + video_driver_index = 0; main_loop = nullptr; visual_server = nullptr; diff --git a/os_switch.h b/os_switch.h index 4907b9f..8ef523c 100644 --- a/os_switch.h +++ b/os_switch.h @@ -42,7 +42,7 @@ class OS_Switch : public OS { int video_driver_index; MainLoop *main_loop; - VideoMode current_videomode; + VideoMode video_mode; VisualServer *visual_server; InputDefault *input; ContextGLSwitchEGL *gl_context; @@ -80,6 +80,7 @@ class OS_Switch : public OS { virtual int get_current_video_driver() const; virtual Size2 get_window_size() const; + virtual bool is_window_always_on_top() const { return true; } virtual Error execute(const String &p_path, const List &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL, bool p_open_console = false); virtual Error kill(const ProcessID &p_pid);