Always detect and use hiDPI in the project manager if needed

This makes its hiDPI behavior consistent with the editor.

(cherry picked from commit 55a2bffac9)
This commit is contained in:
Hugo Locurcio 2018-02-13 18:56:38 +01:00 committed by Hein-Pieter van Braam
parent fda35b3f42
commit 5d7867082d
1 changed files with 23 additions and 8 deletions

View File

@ -121,6 +121,7 @@ static bool force_lowdpi = false;
static int init_screen = -1; static int init_screen = -1;
static bool use_vsync = true; static bool use_vsync = true;
static bool editor = false; static bool editor = false;
static bool project_manager = false;
static bool show_help = false; static bool show_help = false;
static bool disable_render_loop = false; static bool disable_render_loop = false;
static int fixed_fps = -1; static int fixed_fps = -1;
@ -511,6 +512,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-e" || I->get() == "--editor") { // starts editor } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
editor = true; editor = true;
} else if (I->get() == "-p" || I->get() == "--project-manager") { // starts project manager
project_manager = true;
} else if (I->get() == "--no-window") { // disable window creation, Windows only } else if (I->get() == "--no-window") { // disable window creation, Windows only
OS::get_singleton()->set_no_window_mode(true); OS::get_singleton()->set_no_window_mode(true);
@ -788,8 +792,18 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (main_args.size() == 0 && (!ProjectSettings::get_singleton()->has_setting("application/run/main_loop_type")) && (!ProjectSettings::get_singleton()->has_setting("application/run/main_scene") || String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == "")) if (!project_manager) {
// Determine if the project manager should be requested
project_manager =
main_args.size() == 0 &&
!ProjectSettings::get_singleton()->has_setting("application/run/main_loop_type") &&
(!ProjectSettings::get_singleton()->has_setting("application/run/main_scene") ||
String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == "");
}
if (project_manager) {
use_custom_res = false; //project manager (run without arguments) use_custom_res = false; //project manager (run without arguments)
}
#endif #endif
@ -839,9 +853,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2); GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2);
GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3); GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3);
if (editor) { if (editor || project_manager) {
OS::get_singleton()->_allow_hidpi = true; //editors always in hidpi // The editor and project manager always detect and use hiDPI if needed
OS::get_singleton()->_allow_hidpi = true;
} }
Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false); Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false);
OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
if (rtm == -1) { if (rtm == -1) {
@ -1194,7 +1210,6 @@ bool Main::start() {
String test; String test;
String _export_preset; String _export_preset;
bool export_debug = false; bool export_debug = false;
bool project_manager_request = false;
List<String> args = OS::get_singleton()->get_cmdline_args(); List<String> args = OS::get_singleton()->get_cmdline_args();
for (int i = 0; i < args.size(); i++) { for (int i = 0; i < args.size(); i++) {
@ -1204,7 +1219,7 @@ bool Main::start() {
} else if (args[i] == "-e" || args[i] == "--editor") { } else if (args[i] == "-e" || args[i] == "--editor") {
editor = true; editor = true;
} else if (args[i] == "-p" || args[i] == "--project-manager") { } else if (args[i] == "-p" || args[i] == "--project-manager") {
project_manager_request = true; project_manager = true;
} else if (args[i].length() && args[i][0] != '-' && game_path == "") { } else if (args[i].length() && args[i][0] != '-' && game_path == "") {
game_path = args[i]; game_path = args[i];
} }
@ -1482,7 +1497,7 @@ bool Main::start() {
} }
String local_game_path; String local_game_path;
if (game_path != "" && !project_manager_request) { if (game_path != "" && !project_manager) {
local_game_path = game_path.replace("\\", "/"); local_game_path = game_path.replace("\\", "/");
@ -1527,7 +1542,7 @@ bool Main::start() {
#endif #endif
} }
if (!project_manager_request && !editor) { if (!project_manager && !editor) {
if (game_path != "" || script != "") { if (game_path != "" || script != "") {
//autoload //autoload
List<PropertyInfo> props; List<PropertyInfo> props;
@ -1635,7 +1650,7 @@ bool Main::start() {
} }
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (project_manager_request || (script == "" && test == "" && game_path == "" && !editor)) { if (project_manager || (script == "" && test == "" && game_path == "" && !editor)) {
ProjectManager *pmanager = memnew(ProjectManager); ProjectManager *pmanager = memnew(ProjectManager);
ProgressDialog *progress_dialog = memnew(ProgressDialog); ProgressDialog *progress_dialog = memnew(ProgressDialog);