From 6ab0ec547c029f87e889aa4a4cdce257327d4863 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 21 Sep 2021 03:10:09 +0200 Subject: [PATCH 1/2] ui: Make footer items jump around less --- plugins/builtin/source/content/ui_items.cpp | 2 +- .../windows/source/content/{footer_items.cpp => ui_items.cpp} | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) rename plugins/windows/source/content/{footer_items.cpp => ui_items.cpp} (96%) diff --git a/plugins/builtin/source/content/ui_items.cpp b/plugins/builtin/source/content/ui_items.cpp index 933992795..d0ce49506 100644 --- a/plugins/builtin/source/content/ui_items.cpp +++ b/plugins/builtin/source/content/ui_items.cpp @@ -19,7 +19,7 @@ namespace hex::plugin::builtin { framerate = 1.0F / ImGui::GetIO().DeltaTime; } - ImGui::TextUnformatted(hex::format("FPS {0:.2f}", framerate).c_str()); + ImGui::TextUnformatted(hex::format("FPS {0:2}.{1:02}", u32(framerate), u32(framerate * 100) % 100).c_str()); }); } diff --git a/plugins/windows/source/content/footer_items.cpp b/plugins/windows/source/content/ui_items.cpp similarity index 96% rename from plugins/windows/source/content/footer_items.cpp rename to plugins/windows/source/content/ui_items.cpp index 355d2ccd2..297b1e76e 100644 --- a/plugins/windows/source/content/footer_items.cpp +++ b/plugins/windows/source/content/ui_items.cpp @@ -67,9 +67,11 @@ namespace hex::plugin::windows { lastUserCPU = user; lastSysCPU = sys; } + + cpuUsage *= 100; } - ImGui::TextUnformatted(hex::format(ICON_FA_TACHOMETER_ALT " {0:.2f}%", cpuUsage * 100).c_str()); + ImGui::TextUnformatted(hex::format(ICON_FA_TACHOMETER_ALT " {0:2}.{1:02}", u32(cpuUsage), u32(cpuUsage * 100) % 100).c_str()); }); ContentRegistry::Interface::addFooterItem([] { From a7ebf1f60e4ae627a857ba2a86c75c9a34edb3ac Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 21 Sep 2021 03:20:17 +0200 Subject: [PATCH 2/2] build: Adjust old file name in cmake --- plugins/windows/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/windows/CMakeLists.txt b/plugins/windows/CMakeLists.txt index 65e1a0ac4..9387d5b89 100644 --- a/plugins/windows/CMakeLists.txt +++ b/plugins/windows/CMakeLists.txt @@ -13,7 +13,7 @@ if (WIN32) source/lang/en_US.cpp source/lang/zh_CN.cpp - source/content/footer_items.cpp + source/content/ui_items.cpp ) # Add additional include directories here #