From cf397eaa2d561b0d13a443d8e4b29a3c1927242c Mon Sep 17 00:00:00 2001 From: ericek111 Date: Wed, 25 Mar 2026 19:48:16 +0100 Subject: [PATCH] commit no. 6 --- src/ui/Application.cpp | 20 ++++++++++++++++++++ src/ui/Application.h | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/src/ui/Application.cpp b/src/ui/Application.cpp index a9e4bf9..d681048 100644 --- a/src/ui/Application.cpp +++ b/src/ui/Application.cpp @@ -253,6 +253,20 @@ void Application::render() { if (ImGui::BeginMenu("View")) { ImGui::MenuItem("Grid", nullptr, &specDisplay_.showGrid); ImGui::MenuItem("Fill Spectrum", nullptr, &specDisplay_.fillSpectrum); + ImGui::Separator(); + if (ImGui::MenuItem("VSync", nullptr, &vsync_)) { + SDL_GL_SetSwapInterval(vsync_ ? 1 : 0); + } + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("Debug")) { + ImGui::MenuItem("Metrics/Debugger", nullptr, &showMetricsWindow_); + ImGui::MenuItem("Debug Log", nullptr, &showDebugLog_); + ImGui::MenuItem("Stack Tool", nullptr, &showStackTool_); + ImGui::MenuItem("Demo Window", nullptr, &showDemoWindow_); + ImGui::Separator(); + ImGui::Text("%.1f FPS (%.3f ms)", ImGui::GetIO().Framerate, + 1000.0f / ImGui::GetIO().Framerate); ImGui::EndMenu(); } ImGui::EndMenuBar(); @@ -337,6 +351,12 @@ void Application::render() { ImGui::End(); + // ImGui debug windows + if (showDemoWindow_) ImGui::ShowDemoWindow(&showDemoWindow_); + if (showMetricsWindow_) ImGui::ShowMetricsWindow(&showMetricsWindow_); + if (showDebugLog_) ImGui::ShowDebugLogWindow(&showDebugLog_); + if (showStackTool_) ImGui::ShowIDStackToolWindow(&showStackTool_); + // Render ImGui::Render(); int displayW, displayH; diff --git a/src/ui/Application.h b/src/ui/Application.h index e878fb4..2c3f81f 100644 --- a/src/ui/Application.h +++ b/src/ui/Application.h @@ -113,6 +113,7 @@ private: float maxDB_ = 0.0f; FreqScale freqScale_ = FreqScale::Linear; bool paused_ = false; + bool vsync_ = true; // (waterfallW_ removed — texture width tracks bin count automatically) // (waterfallH_ removed — fixed history depth of 1024 rows) @@ -171,6 +172,12 @@ private: float specPosX_ = 0, specPosY_ = 0, specSizeX_ = 0, specSizeY_ = 0; float wfPosX_ = 0, wfPosY_ = 0, wfSizeX_ = 0, wfSizeY_ = 0; + // ImGui debug windows + bool showDemoWindow_ = false; + bool showMetricsWindow_ = false; + bool showDebugLog_ = false; + bool showStackTool_ = false; + // Pre-allocated scratch buffers (avoid per-frame heap allocations) std::vector> wfSpectraScratch_; std::vector wfChInfoScratch_;