diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-05-17 12:55:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 12:55:53 +0200 |
commit | 129767da7063ffb6a4e0d592d478b51b0be0be1b (patch) | |
tree | 77b516b1d76ca6f78ad7a3edcf74efc60a8a7931 /main/main.cpp | |
parent | d64fc0c11442b17a2d81edb3a3042d9a34b6621e (diff) | |
parent | 2d56dfb746fb05c8cab090e4b411b1987e990fca (diff) |
Merge pull request #60159 from Calinou/print-fps-hide-unstable-prints
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp index b1aee3f60a..191f4d684f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2634,6 +2634,7 @@ bool Main::start() { uint64_t Main::last_ticks = 0; uint32_t Main::frames = 0; +uint32_t Main::hide_print_fps_attempts = 3; uint32_t Main::frame = 0; bool Main::force_redraw_requested = false; int Main::iterating = 0; @@ -2774,12 +2775,17 @@ bool Main::iteration() { Engine::get_singleton()->_process_frames++; if (frame > 1000000) { - if (editor || project_manager) { - if (print_fps) { - print_line(vformat("Editor FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2))); + // Wait a few seconds before printing FPS, as FPS reporting just after the engine has started is inaccurate. + if (hide_print_fps_attempts == 0) { + if (editor || project_manager) { + if (print_fps) { + print_line(vformat("Editor FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2))); + } + } else if (print_fps || GLOBAL_GET("debug/settings/stdout/print_fps")) { + print_line(vformat("Project FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2))); } - } else if (GLOBAL_GET("debug/settings/stdout/print_fps") || print_fps) { - print_line(vformat("Project FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2))); + } else { + hide_print_fps_attempts--; } Engine::get_singleton()->_fps = frames; |