diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/main/main.cpp b/main/main.cpp index 82b79cd9a2..ffc02d8823 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -127,6 +127,7 @@ static bool disable_render_loop = false; static int fixed_fps = -1; static bool auto_build_solutions = false; static bool auto_quit = false; +static bool print_fps = false; static OS::ProcessID allow_focus_steal_pid = 0; @@ -255,6 +256,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n"); OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n"); OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n"); + OS::get_singleton()->print(" --print-fps Print the frames per second to the stdout.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Standalone tools:\n"); @@ -665,6 +667,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->print("Missing fixed-fps argument, aborting.\n"); goto error; } + } else if (I->get() == "--print-fps") { + print_fps = true; } else if (I->get() == "--disable-crash-handler") { OS::get_singleton()->disable_crash_handler(); } else { @@ -689,6 +693,19 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph I = N; } + if (globals->setup(game_path, main_pack, upwards) == OK) { + found_project = true; + } else { + +#ifdef TOOLS_ENABLED + editor = false; +#else + OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data()); + + goto error; +#endif + } + GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60); GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048); GLOBAL_DEF("network/limits/debugger_stdout/max_messages_per_frame", 10); @@ -761,19 +778,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif - if (globals->setup(game_path, main_pack, upwards) == OK) { - found_project = true; - } else { - -#ifdef TOOLS_ENABLED - editor = false; -#else - OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data()); - - goto error; -#endif - } - GLOBAL_DEF("logging/file_logging/enable_file_logging", false); GLOBAL_DEF("logging/file_logging/log_path", "user://logs/log.txt"); GLOBAL_DEF("logging/file_logging/max_log_files", 10); @@ -953,7 +957,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/physics_fps", 60)); Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0)); - GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()); + GLOBAL_DEF("debug/settings/stdout/print_fps", false); if (!OS::get_singleton()->_verbose_stdout) //overridden OS::get_singleton()->_verbose_stdout = GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false); @@ -1137,13 +1141,16 @@ Error Main::setup2(Thread::ID p_main_tid_override) { GLOBAL_DEF("application/config/icon", String()); ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp")); - if (bool(GLOBAL_DEF("display/window/handheld/emulate_touchscreen", false))) { - if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !(editor || project_manager)) { - //only if no touchscreen ui hint, set emulation - InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton()); - if (id) - id->set_emulate_touch(true); + InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton()); + if (id) { + if (bool(GLOBAL_DEF("input/pointing_devices/emulate_touch_from_mouse", false)) && !(editor || project_manager)) { + if (!OS::get_singleton()->has_touchscreen_ui_hint()) { + //only if no touchscreen ui hint, set emulation + id->set_emulate_touch_from_mouse(true); + } } + + id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF("input/pointing_devices/emulate_mouse_from_touch", true))); } MAIN_PRINT("Main: Load Remaps"); @@ -1308,7 +1315,7 @@ bool Main::start() { DocData docsrc; Map<String, String> doc_data_classes; Set<String> checked_paths; - print_line("Loading docs.."); + print_line("Loading docs..."); for (int i = 0; i < _doc_data_class_path_count; i++) { String path = doc_tool.plus_file(_doc_data_class_paths[i].path); @@ -1326,14 +1333,14 @@ bool Main::start() { checked_paths.insert(index_path); print_line("Loading docs from: " + index_path); - print_line("Merging docs.."); + print_line("Merging docs..."); doc.merge_from(docsrc); for (Set<String>::Element *E = checked_paths.front(); E; E = E->next()) { print_line("Erasing old docs at: " + E->get()); DocData::erase_classes(E->get()); } - print_line("Generating new docs.."); + print_line("Generating new docs..."); doc.save_classes(index_path, doc_data_classes); return false; @@ -1508,7 +1515,7 @@ bool Main::start() { bool snap_controls = GLOBAL_DEF("gui/common/snap_controls_to_pixels", true); sml->get_root()->set_snap_controls_to_pixels(snap_controls); - bool font_oversampling = GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", false); + bool font_oversampling = GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", true); sml->set_use_font_oversampling(font_oversampling); } else { @@ -1521,7 +1528,7 @@ bool Main::start() { sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true)); sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true)); GLOBAL_DEF("gui/common/snap_controls_to_pixels", true); - GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", false); + GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", true); } String local_game_path; @@ -1826,9 +1833,13 @@ bool Main::iteration() { if (frame > 1000000) { - if (GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()) && !editor) { - print_line("FPS: " + itos(frames)); - }; + if (editor || project_manager) { + if (print_fps) { + print_line("Editor FPS: " + itos(frames)); + } + } else if (GLOBAL_GET("debug/settings/stdout/print_fps") || print_fps) { + print_line("Game FPS: " + itos(frames)); + } Engine::get_singleton()->_fps = frames; performance->set_process_time(USEC_TO_SEC(idle_process_max)); |