From 6527c942c2b8c6ea5a636936969c756d3b237d8c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 21 Apr 2021 19:26:50 +0200 Subject: [PATCH] ui: Fixed FPS display not being visible --- source/window.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/window.cpp b/source/window.cpp index 05d2c3e49..bc92498b6 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -351,11 +351,13 @@ namespace hex { } if (this->m_fpsVisible) { - char buffer[0x20]; - snprintf(buffer, 0x20, "%.1f FPS", ImGui::GetIO().Framerate); - - ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetFontSize() * strlen(buffer) + 20); - ImGui::TextUnformatted(buffer); + ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetCursorPosX() - 3 * ImGui::GetFontSize()); + ImGui::Text("%.1f FPS", ImGui::GetIO().Framerate); + } else { + #if defined(DEBUG) + ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetCursorPosX()); + ImGui::Text(ICON_FA_BUG, ImGui::GetIO().Framerate); + #endif } ImGui::EndMenuBar();