From cc7880fba55e945b8a37fa8aca5a7faa065d3f6c Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 12 Dec 2015 12:06:53 -0300 Subject: [PATCH] -added windowed mode with -w, fixes #3020 -changed default windowed resolution to 1280x720 --- core/os/os.h | 2 +- main/main.cpp | 17 +++++++++++------ platform/osx/os_osx.mm | 4 ++-- platform/windows/os_windows.cpp | 2 +- platform/x11/os_x11.cpp | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/core/os/os.h b/core/os/os.h index e908177df7..ab1a07276c 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -75,7 +75,7 @@ public: bool fullscreen; bool resizable; float get_aspect() const { return (float)width/(float)height; } - VideoMode(int p_width=640,int p_height=480,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; } + VideoMode(int p_width=1280,int p_height=720,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; } }; protected: friend class Main; diff --git a/main/main.cpp b/main/main.cpp index a060dbd232..66391ffa7e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -95,6 +95,7 @@ static TranslationServer *translation_server = NULL; static OS::VideoMode video_mode; static bool init_maximized=false; +static bool init_windowed=false; static bool init_fullscreen=false; static bool init_use_custom_pos=false; static bool debug_collisions=false; @@ -146,6 +147,7 @@ void Main::print_help(const char* p_binary) { OS::get_singleton()->print("\t-p XxY\t : Request Window Position\n"); OS::get_singleton()->print("\t-f\t\t : Request Fullscreen\n"); OS::get_singleton()->print("\t-mx\t\t Request Maximized\n"); + OS::get_singleton()->print("\t-w\t\t Request Windowed\n"); OS::get_singleton()->print("\t-vd DRIVER\t : Video Driver ("); for (int i=0;iget_video_driver_count();i++) { @@ -354,6 +356,9 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } else if (I->get()=="-mx") { // video driver init_maximized=true; + } else if (I->get()=="-w") { // video driver + + init_windowed=true; } else if (I->get()=="-vd") { // video driver if (I->next()) { @@ -841,11 +846,7 @@ Error Main::setup2() { if (init_use_custom_pos) { OS::get_singleton()->set_window_position(init_custom_pos); } - if (init_maximized) { - OS::get_singleton()->set_window_maximized(true); - } else if (init_fullscreen) { - OS::get_singleton()->set_window_fullscreen(true); - } + register_core_singletons(); @@ -859,8 +860,12 @@ Error Main::setup2() { if (init_screen!=-1) { OS::get_singleton()->set_current_screen(init_screen); } - if (init_maximized) { + if (init_windowed) { + //do none.. + } else if (init_maximized) { OS::get_singleton()->set_window_maximized(true); + } else if (init_fullscreen) { + OS::get_singleton()->set_window_fullscreen(true); } MAIN_PRINT("Main: Load Remaps"); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 4990d04ab6..a2c4737aec 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -838,8 +838,8 @@ const char * OS_OSX::get_video_driver_name(int p_driver) const { OS::VideoMode OS_OSX::get_default_video_mode() const { VideoMode vm; - vm.width=800; - vm.height=600; + vm.width=1280; + vm.height=720; vm.fullscreen=false; vm.resizable=true; return vm; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 1fb8e6dbd0..49ce1d3b9a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -148,7 +148,7 @@ const char * OS_Windows::get_video_driver_name(int p_driver) const { OS::VideoMode OS_Windows::get_default_video_mode() const { - return VideoMode(800,600,false); + return VideoMode(1280,720,false); } int OS_Windows::get_audio_driver_count() const { diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 4f1b475d06..13dc1069a3 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -82,7 +82,7 @@ const char * OS_X11::get_video_driver_name(int p_driver) const { } OS::VideoMode OS_X11::get_default_video_mode() const { - return OS::VideoMode(800,600,false); + return OS::VideoMode(1280,720,false); } int OS_X11::get_audio_driver_count() const {