diff --git a/src/cpp/re/edit/AppContext.cpp b/src/cpp/re/edit/AppContext.cpp index 6d12ca2..c27a052 100644 --- a/src/cpp/re/edit/AppContext.cpp +++ b/src/cpp/re/edit/AppContext.cpp @@ -393,6 +393,7 @@ void AppContext::render() ImGui::PopID(); // Rendering + // Clipboard ImGui::SeparatorText("Clipboard"); if(ReGui::ResetButton()) { @@ -401,11 +402,13 @@ void AppContext::render() ImGui::SameLine(); ImGui::TextUnformatted(fClipboard.getData()->getDescription().c_str()); -#ifndef NDEBUG - ImGui::Separator(); - ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, - ImGui::GetIO().Framerate); -#endif + // Performance + if(Application::GetCurrent().isShowPerformance()) + { + ImGui::SeparatorText("Performance"); + ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, + ImGui::GetIO().Framerate); + } } fCurrentPanelState->render(*this); diff --git a/src/cpp/re/edit/Application.cpp b/src/cpp/re/edit/Application.cpp index 8bb405d..20c0bc2 100644 --- a/src/cpp/re/edit/Application.cpp +++ b/src/cpp/re/edit/Application.cpp @@ -1221,6 +1221,7 @@ void Application::renderApplicationMenuItems() { fContext->setVSyncEnabled(fConfig.fVSyncEnabled); } + ImGui::MenuItem("Show Performance", nullptr, &fConfig.fShowPerformance); ImGui::EndMenu(); } if(ImGui::MenuItem("Check For Updates...", nullptr, false, !hasAsyncAction(kCheckForUpdatesKey))) diff --git a/src/cpp/re/edit/Application.h b/src/cpp/re/edit/Application.h index fdab728..3b11cf4 100644 --- a/src/cpp/re/edit/Application.h +++ b/src/cpp/re/edit/Application.h @@ -106,6 +106,7 @@ class Application constexpr int getTargetFrameRate() const { return fConfig.fTargetFrameRate; } constexpr bool isVSyncEnabled() const { return fConfig.fVSyncEnabled; } + constexpr bool isShowPerformance() const { return fConfig.fShowPerformance; } void onNativeWindowFontDpiScaleChange(float iFontDpiScale); void onNativeWindowFontScaleChange(float iFontScale); diff --git a/src/cpp/re/edit/Config.h b/src/cpp/re/edit/Config.h index a04f6bc..9a7e8f8 100644 --- a/src/cpp/re/edit/Config.h +++ b/src/cpp/re/edit/Config.h @@ -230,6 +230,7 @@ struct Global bool fSaveEnabled{true}; int fTargetFrameRate{60}; bool fVSyncEnabled{false}; + bool fShowPerformance{false}; std::vector fDeviceHistory{}; diff --git a/src/cpp/re/edit/PreferencesManager.cpp b/src/cpp/re/edit/PreferencesManager.cpp index 7e8eeb5..dc62d52 100644 --- a/src/cpp/re/edit/PreferencesManager.cpp +++ b/src/cpp/re/edit/PreferencesManager.cpp @@ -63,6 +63,7 @@ std::string PreferencesManager::getAsLua(config::Global const &iConfig) s << fmt::printf("global_config[\"style\"] = \"%s\"\n", config::to_string(iConfig.fStyle)); s << fmt::printf("global_config[\"target_frame_rate\"] = %d\n", iConfig.fTargetFrameRate); s << fmt::printf("global_config[\"vsync_enabled\"] = %s\n", fmt::Bool::to_chars(iConfig.fVSyncEnabled)); + s << fmt::printf("global_config[\"show_performance\"] = %s\n", fmt::Bool::to_chars(iConfig.fShowPerformance)); auto const &history = iConfig.fDeviceHistory; if(!history.empty()) diff --git a/src/cpp/re/edit/lua/ConfigParser.cpp b/src/cpp/re/edit/lua/ConfigParser.cpp index 51839cc..596e5d9 100644 --- a/src/cpp/re/edit/lua/ConfigParser.cpp +++ b/src/cpp/re/edit/lua/ConfigParser.cpp @@ -43,6 +43,7 @@ config::Global GlobalConfigParser::getConfig() withOptionalValue(L.getTableValueAsOptionalNumber("font_size"), [&c](auto v) { c.fFontSize = v; }); withOptionalValue(L.getTableValueAsOptionalInteger("target_frame_rate"), [&c](auto v) { c.fTargetFrameRate = v; }); withOptionalValue(L.getTableValueAsOptionalBoolean("vsync_enabled"), [&c](auto v) { c.fVSyncEnabled = v; }); + withOptionalValue(L.getTableValueAsOptionalBoolean("show_performance"), [&c](auto v) { c.fShowPerformance = v; }); withOptionalValue(L.getTableValueAsOptionalString("style"), [&c](auto v) { v = Utils::str_tolower(v); if(v == "light") diff --git a/test/cpp/re/edit/lua/TestConfigParser.cpp b/test/cpp/re/edit/lua/TestConfigParser.cpp index ecf0772..1135455 100644 --- a/test/cpp/re/edit/lua/TestConfigParser.cpp +++ b/test/cpp/re/edit/lua/TestConfigParser.cpp @@ -30,6 +30,7 @@ global_config["font_size"] = 20 global_config["style"] = "Dark" global_config["target_frame_rate"] = 60 global_config["vsync_enabled"] = false +global_config["show_performance"] = false global_config["device_history"] = {} global_config["device_history"][1] = { name = "CVA-7 CV Analyzer",