diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-11-09 13:01:29 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-11-09 13:02:26 -0300 |
commit | d09160a8b67fdc60e8108962c4e9bd4c0bc7f13e (patch) | |
tree | 0985e60700a61ab8e1efe52c51393cf5319b7bae /main | |
parent | e4effb4d53d5d6e53e4f0e0d14b243eb9a319272 (diff) |
Make video mode initialization more intuitive, fixes #12022
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/main/main.cpp b/main/main.cpp index 5e8e52d3e5..37d233dff3 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -321,8 +321,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph I = args.front(); - video_mode = OS::get_singleton()->get_default_video_mode(); - String video_driver = ""; String audio_driver = ""; String game_path = "."; @@ -779,36 +777,33 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph //if (video_driver == "") // useless for now, so removing // video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0))); - if (!force_res && use_custom_res && globals->has_setting("display/window/size/width")) - video_mode.width = globals->get("display/window/size/width"); - if (!force_res && use_custom_res && globals->has_setting("display/window/size/height")) - video_mode.height = globals->get("display/window/size/height"); - if (!editor && ((globals->has_setting("display/window/dpi/allow_hidpi") && !globals->get("display/window/dpi/allow_hidpi")) || force_lowdpi)) { - OS::get_singleton()->_allow_hidpi = false; - } - if (use_custom_res && globals->has_setting("display/window/size/fullscreen")) - video_mode.fullscreen = globals->get("display/window/size/fullscreen"); - if (use_custom_res && globals->has_setting("display/window/size/resizable")) - video_mode.resizable = globals->get("display/window/size/resizable"); - if (use_custom_res && globals->has_setting("display/window/size/borderless")) - video_mode.borderless_window = globals->get("display/window/size/borderless"); - - if (!force_res && use_custom_res && globals->has_setting("display/window/size/test_width") && globals->has_setting("display/window/size/test_height")) { - int tw = globals->get("display/window/size/test_width"); - int th = globals->get("display/window/size/test_height"); - if (tw > 0 && th > 0) { - video_mode.width = tw; - video_mode.height = th; + if (use_custom_res) { + + if (!force_res) { + video_mode.width = GLOBAL_DEF("display/window/size/width", 1024); + video_mode.height = GLOBAL_DEF("display/window/size/height", 600); + + if (globals->has_setting("display/window/size/test_width") && globals->has_setting("display/window/size/test_height")) { + int tw = globals->get("display/window/size/test_width"); + int th = globals->get("display/window/size/test_height"); + if (tw > 0 && th > 0) { + video_mode.width = tw; + video_mode.height = th; + } + } } + + video_mode.resizable = GLOBAL_DEF("display/window/size/resizable", true); + video_mode.borderless_window = GLOBAL_DEF("display/window/size/borderless", false); + video_mode.fullscreen = GLOBAL_DEF("display/window/size/fullscreen", false); } - GLOBAL_DEF("display/window/size/width", video_mode.width); - GLOBAL_DEF("display/window/size/height", video_mode.height); - GLOBAL_DEF("display/window/dpi/allow_hidpi", false); - GLOBAL_DEF("display/window/size/fullscreen", video_mode.fullscreen); - GLOBAL_DEF("display/window/size/resizable", video_mode.resizable); - GLOBAL_DEF("display/window/size/borderless", video_mode.borderless_window); - use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", use_vsync); + if (!force_lowdpi) { + OS::get_singleton()->_allow_hidpi = GLOBAL_DEF("display/window/dpi/allow_hidpi", false); + } + + use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", true); + GLOBAL_DEF("display/window/size/test_width", 0); GLOBAL_DEF("display/window/size/test_height", 0); GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2); |