Overlay toggle: F1 hides the UI for a clean RPT mirror

The ImGui overlay was always visible, so the mirror window Steam Remote Play
Together captures always had debug panels drawn over the game. F1 now toggles
the whole overlay off; the input/video/audio pipelines keep running
underneath. When hidden, a small "F1: show overlay" hint fades out over ~4s so
the operator can find the way back, then the window is fully clean.

First item of the "make the tool usable" roadmap task.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 15:01:23 +02:00
parent 88db914914
commit 2df5a3752e
2 changed files with 51 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ void draw_debug_overlay(const InputSource& input)
ImGui::Text("Input backend: %s", input.name());
ImGui::Text("%.1f FPS (%.2f ms)", ImGui::GetIO().Framerate, 1000.0f / ImGui::GetIO().Framerate);
ImGui::TextDisabled("This window is what Remote Play Together captures.");
ImGui::TextDisabled("Press Esc to quit.");
ImGui::TextDisabled("F1: hide overlay (clean mirror) Esc: quit");
ImGui::Separator();
const auto& pads = input.pads();

View File

@@ -11,6 +11,8 @@
#include <winrt/Windows.Foundation.h>
#include "imgui.h"
#include "audio_panel.hpp"
#include "capture_panel.hpp"
#include "d3d11_window.hpp"
@@ -22,6 +24,28 @@
namespace
{
// When the overlay is hidden, briefly show a fading hint so the operator can find
// the way back. The window is borderless and non-interactive so it never steals a
// click or a frame from the mirror underneath.
void draw_overlay_hidden_hint(double seconds_hidden)
{
const float fade = 1.0f - static_cast<float>(seconds_hidden) / 4.0f;
if (fade <= 0.0f)
{
return; // fully faded -> truly clean window for RPT capture
}
ImGui::SetNextWindowPos(ImVec2(12.0f, 12.0f));
ImGui::SetNextWindowBgAlpha(0.35f * fade);
const ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs |
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings |
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
ImGui::Begin("##overlay_hint", nullptr, flags);
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, fade));
ImGui::TextUnformatted("F1: show overlay");
ImGui::PopStyleColor();
ImGui::End();
}
int run()
{
coop::D3D11Window window;
@@ -48,6 +72,11 @@ int run()
return 1;
}
// The overlay can be hidden (F1) so the window is a clean mirror for Remote
// Play Together; the pipelines keep running underneath either way.
bool show_overlay = true;
double overlay_hidden_at = 0.0;
while (window.pump_messages())
{
input->poll();
@@ -57,10 +86,27 @@ int run()
audio.set_target(game);
imgui.begin_frame();
coop::draw_debug_overlay(*input);
injection.draw();
audio.draw_ui(injection.hook_status());
capture.draw_ui();
if (ImGui::IsKeyPressed(ImGuiKey_F1, false))
{
show_overlay = !show_overlay;
if (!show_overlay)
{
overlay_hidden_at = ImGui::GetTime();
}
}
if (show_overlay)
{
coop::draw_debug_overlay(*input);
injection.draw();
audio.draw_ui(injection.hook_status());
capture.draw_ui();
}
else
{
draw_overlay_hidden_hint(ImGui::GetTime() - overlay_hidden_at);
}
RECT client = {};
GetClientRect(window.hwnd(), &client);