Generalize UI: main menu bar with panel toggles + frame stats

Add a top menu bar (host/src/ui/app_chrome) as the overlay shell:
- View menu toggles each panel (Controllers / Injection / Video / Audio)
  and a global "Debug details" switch (consumed by panels in a follow-up).
- A right-aligned performance readout: stable 1 s FPS plus the frame-time
  spread (avg, min-max) so stutter is visible; it turns amber on a >25 ms
  spike. FrameStats keeps the rolling window.

Consolidates the FPS that was duplicated in the controllers and video
panels into this one readout.

First structural step of the "generalize the UI" roadmap task; content
rework (debug-vs-general split, renaming the spike-era readouts) follows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 15:03:50 +02:00
parent 2df5a3752e
commit b48cdd6515
6 changed files with 168 additions and 6 deletions

View File

@@ -20,6 +20,7 @@
#include "imgui_layer.hpp"
#include "injection_panel.hpp"
#include "input/xinput_source.hpp"
#include "ui/app_chrome.hpp"
namespace
{
@@ -76,6 +77,8 @@ int run()
// Play Together; the pipelines keep running underneath either way.
bool show_overlay = true;
double overlay_hidden_at = 0.0;
coop::UiState ui;
coop::FrameStats stats;
while (window.pump_messages())
{
@@ -86,6 +89,7 @@ int run()
audio.set_target(game);
imgui.begin_frame();
stats.tick(ImGui::GetIO().DeltaTime * 1000.0f);
if (ImGui::IsKeyPressed(ImGuiKey_F1, false))
{
@@ -98,10 +102,23 @@ int run()
if (show_overlay)
{
coop::draw_debug_overlay(*input);
injection.draw();
audio.draw_ui(injection.hook_status());
capture.draw_ui();
coop::draw_main_menu_bar(ui, stats);
if (ui.show_controllers)
{
coop::draw_debug_overlay(*input);
}
if (ui.show_injection)
{
injection.draw();
}
if (ui.show_audio)
{
audio.draw_ui(injection.hook_status());
}
if (ui.show_video)
{
capture.draw_ui();
}
}
else
{