From b31f6f78a314da303b9e464a3331ed690c3a3c5f Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 9 Nov 2021 17:20:18 +0100 Subject: [PATCH] Display 2 decimals instead of 1 in editor frametime labels When comparing different graphics settings or optimizations, this makes precise measurements and frametime comparisons easier. This also makes the editor FPS display use `pad_decimals()` for consistency with the implementation in `master`. --- editor/plugins/spatial_editor_plugin.cpp | 2 +- main/main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 60bc35d8bb..3ef78a7841 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2618,7 +2618,7 @@ void SpatialEditorViewport::_notification(int p_what) { if (show_fps) { String text; const float temp_fps = Engine::get_singleton()->get_frames_per_second(); - text += vformat(TTR("FPS: %d (%s ms)"), temp_fps, String::num(1000.0f / temp_fps, 2)); + text += vformat(TTR("FPS: %d (%s ms)"), temp_fps, rtos(1000.0f / temp_fps).pad_decimals(2)); fps_label->set_text(text); } diff --git a/main/main.cpp b/main/main.cpp index feaaeae249..26fe2ecc4f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2248,10 +2248,10 @@ bool Main::iteration() { 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(1))); + print_line(vformat("Editor 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(1))); + print_line(vformat("Project FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2))); } Engine::get_singleton()->_fps = frames;