diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/input_default.cpp | 14 | ||||
-rw-r--r-- | main/input_default.h | 2 | ||||
-rw-r--r-- | main/main.cpp | 42 | ||||
-rw-r--r-- | main/performance.cpp | 12 | ||||
-rw-r--r-- | main/performance.h | 6 |
5 files changed, 40 insertions, 36 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index 18979c844a..2940f432d5 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -105,8 +105,8 @@ bool InputDefault::is_action_just_pressed(const StringName &p_action) const { if (!E) return false; - if (Engine::get_singleton()->is_in_fixed_frame()) { - return E->get().pressed && E->get().fixed_frame == Engine::get_singleton()->get_fixed_frames(); + if (Engine::get_singleton()->is_in_physics_frame()) { + return E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames(); } else { return E->get().pressed && E->get().idle_frame == Engine::get_singleton()->get_idle_frames(); } @@ -118,8 +118,8 @@ bool InputDefault::is_action_just_released(const StringName &p_action) const { if (!E) return false; - if (Engine::get_singleton()->is_in_fixed_frame()) { - return !E->get().pressed && E->get().fixed_frame == Engine::get_singleton()->get_fixed_frames(); + if (Engine::get_singleton()->is_in_physics_frame()) { + return !E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames(); } else { return !E->get().pressed && E->get().idle_frame == Engine::get_singleton()->get_idle_frames(); } @@ -324,7 +324,7 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) { if (InputMap::get_singleton()->event_is_action(p_event, E->key()) && is_action_pressed(E->key()) != p_event->is_pressed()) { Action action; - action.fixed_frame = Engine::get_singleton()->get_fixed_frames(); + action.physics_frame = Engine::get_singleton()->get_physics_frames(); action.idle_frame = Engine::get_singleton()->get_idle_frames(); action.pressed = p_event->is_pressed(); action_state[E->key()] = action; @@ -460,7 +460,7 @@ void InputDefault::action_press(const StringName &p_action) { Action action; - action.fixed_frame = Engine::get_singleton()->get_fixed_frames(); + action.physics_frame = Engine::get_singleton()->get_physics_frames(); action.idle_frame = Engine::get_singleton()->get_idle_frames(); action.pressed = true; @@ -471,7 +471,7 @@ void InputDefault::action_release(const StringName &p_action) { Action action; - action.fixed_frame = Engine::get_singleton()->get_fixed_frames(); + action.physics_frame = Engine::get_singleton()->get_physics_frames(); action.idle_frame = Engine::get_singleton()->get_idle_frames(); action.pressed = false; diff --git a/main/input_default.h b/main/input_default.h index 480e78e971..e2cb03e67c 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -51,7 +51,7 @@ class InputDefault : public Input { MainLoop *main_loop; struct Action { - uint64_t fixed_frame; + uint64_t physics_frame; uint64_t idle_frame; bool pressed; }; diff --git a/main/main.cpp b/main/main.cpp index 9096b935c2..e06f423bfc 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -231,7 +231,6 @@ void Main::print_help(const char *p_binary) { } Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phase) { - RID_OwnerBase::init_rid(); OS::get_singleton()->initialize_core(); @@ -254,6 +253,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph register_core_settings(); //here globals is present + OS::get_singleton()->initialize_logger(); + translation_server = memnew(TranslationServer); performance = memnew(Performance); globals->add_singleton(ProjectSettings::Singleton("Performance", performance)); @@ -725,7 +726,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED - if (main_args.size() == 0 && (!ProjectSettings::get_singleton()->has("application/run/main_loop_type")) && (!ProjectSettings::get_singleton()->has("application/run/main_scene") || String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == "")) + 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")) == "")) use_custom_res = false; //project manager (run without arguments) #endif @@ -738,21 +739,21 @@ 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("display/window/size/width")) + 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("display/window/size/height")) + 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("display/window/dpi/allow_hidpi") && !globals->get("display/window/dpi/allow_hidpi")) || force_lowdpi)) { + 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("display/window/size/fullscreen")) + 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("display/window/size/resizable")) + 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("display/window/size/borderless")) + 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("display/window/size/test_width") && globals->has("display/window/size/test_height")) { + 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) { @@ -773,6 +774,9 @@ 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.mobile", 3); + if (editor) { + OS::get_singleton()->_allow_hidpi = true; //editors always in hidpi + } 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); if (rtm == -1) { @@ -1574,7 +1578,7 @@ uint32_t Main::frame = 0; bool Main::force_redraw_requested = false; //for performance metrics -static uint64_t fixed_process_max = 0; +static uint64_t physics_process_max = 0; static uint64_t idle_process_max = 0; bool Main::iteration() { @@ -1597,7 +1601,7 @@ bool Main::iteration() { return false; */ - uint64_t fixed_process_ticks = 0; + uint64_t physics_process_ticks = 0; uint64_t idle_process_ticks = 0; frame += ticks_elapsed; @@ -1615,7 +1619,7 @@ bool Main::iteration() { int iters = 0; - Engine::get_singleton()->_in_fixed = true; + Engine::get_singleton()->_in_physics = true; while (time_accum > frame_slice) { @@ -1642,13 +1646,13 @@ bool Main::iteration() { time_accum -= frame_slice; message_queue->flush(); - fixed_process_ticks = MAX(fixed_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference - fixed_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, fixed_process_max); + physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference + physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, physics_process_max); iters++; - Engine::get_singleton()->_fixed_frames++; + Engine::get_singleton()->_physics_frames++; } - Engine::get_singleton()->_in_fixed = false; + Engine::get_singleton()->_in_physics = false; uint64_t idle_begin = OS::get_singleton()->get_ticks_usec(); @@ -1684,7 +1688,7 @@ bool Main::iteration() { if (script_debugger) { if (script_debugger->is_profiling()) { - script_debugger->profiling_set_frame_times(USEC_TO_SEC(frame_time), USEC_TO_SEC(idle_process_ticks), USEC_TO_SEC(fixed_process_ticks), frame_slice); + script_debugger->profiling_set_frame_times(USEC_TO_SEC(frame_time), USEC_TO_SEC(idle_process_ticks), USEC_TO_SEC(physics_process_ticks), frame_slice); } script_debugger->idle_poll(); } @@ -1700,9 +1704,9 @@ bool Main::iteration() { Engine::get_singleton()->_fps = frames; performance->set_process_time(USEC_TO_SEC(idle_process_max)); - performance->set_fixed_process_time(USEC_TO_SEC(fixed_process_max)); + performance->set_physics_process_time(USEC_TO_SEC(physics_process_max)); idle_process_max = 0; - fixed_process_max = 0; + physics_process_max = 0; frame %= 1000000; frames = 0; diff --git a/main/performance.cpp b/main/performance.cpp index 4dac6c119e..0f3383c4a8 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -42,7 +42,7 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(TIME_FPS); BIND_ENUM_CONSTANT(TIME_PROCESS); - BIND_ENUM_CONSTANT(TIME_FIXED_PROCESS); + BIND_ENUM_CONSTANT(TIME_PHYSICS_PROCESS); BIND_ENUM_CONSTANT(MEMORY_STATIC); BIND_ENUM_CONSTANT(MEMORY_DYNAMIC); BIND_ENUM_CONSTANT(MEMORY_STATIC_MAX); @@ -78,7 +78,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const { "time/fps", "time/process", - "time/fixed_process", + "time/physics_process", "memory/static", "memory/dynamic", "memory/static_max", @@ -114,7 +114,7 @@ float Performance::get_monitor(Monitor p_monitor) const { switch (p_monitor) { case TIME_FPS: return Engine::get_singleton()->get_frames_per_second(); case TIME_PROCESS: return _process_time; - case TIME_FIXED_PROCESS: return _fixed_process_time; + case TIME_PHYSICS_PROCESS: return _physics_process_time; case MEMORY_STATIC: return Memory::get_mem_usage(); case MEMORY_DYNAMIC: return MemoryPool::total_memory; case MEMORY_STATIC_MAX: return Memory::get_mem_max_usage(); @@ -158,14 +158,14 @@ void Performance::set_process_time(float p_pt) { _process_time = p_pt; } -void Performance::set_fixed_process_time(float p_pt) { +void Performance::set_physics_process_time(float p_pt) { - _fixed_process_time = p_pt; + _physics_process_time = p_pt; } Performance::Performance() { _process_time = 0; - _fixed_process_time = 0; + _physics_process_time = 0; singleton = this; } diff --git a/main/performance.h b/main/performance.h index a9e3c07d7c..900e6434b7 100644 --- a/main/performance.h +++ b/main/performance.h @@ -43,14 +43,14 @@ class Performance : public Object { static void _bind_methods(); float _process_time; - float _fixed_process_time; + float _physics_process_time; public: enum Monitor { TIME_FPS, TIME_PROCESS, - TIME_FIXED_PROCESS, + TIME_PHYSICS_PROCESS, MEMORY_STATIC, MEMORY_DYNAMIC, MEMORY_STATIC_MAX, @@ -83,7 +83,7 @@ public: String get_monitor_name(Monitor p_monitor) const; void set_process_time(float p_pt); - void set_fixed_process_time(float p_pt); + void set_physics_process_time(float p_pt); static Performance *get_singleton() { return singleton; } |