Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Godot 3.5] Return a real video mode #6

Open
wants to merge 1 commit into
base: 3.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions os_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<OS::VideoMode> *p_list, int p_screen) const {}
void OS_Switch::get_fullscreen_mode_list(List<OS::VideoMode> *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) {
Expand All @@ -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<String> &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) {
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion os_switch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> &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);
Expand Down