diff --git a/host/src/debug_overlay.cpp b/host/src/debug_overlay.cpp index 0358995..8e51ee2 100644 --- a/host/src/debug_overlay.cpp +++ b/host/src/debug_overlay.cpp @@ -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(); diff --git a/host/src/main.cpp b/host/src/main.cpp index 4a11f03..a3aefd1 100644 --- a/host/src/main.cpp +++ b/host/src/main.cpp @@ -11,6 +11,8 @@ #include +#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(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);