You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a per-window title-bar screenshot button (debug / docs affordance)
Adds a camera icon next to the existing settings cog on every Toolbox
window's title bar. Clicking it saves a PNG of just that window's
pixel rect to the Toolbox Screens folder, so we can capture docs
illustrations without faffing about with full-screen screenshots and
cropping. Off by default, gated by two new ini settings
(show_screenshot_button_in_outpost / _in_explorable) and a matching
checkbox pair under Settings -> Toolbox Settings -> "Show screenshot
button in:".
Implementation:
* Resources::SaveBackbufferRectToFile takes an IDirect3DDevice9 and
an optional sub-rect. It grabs the current render target, copies
it to a SYSTEMMEM offscreen plain surface (GetRenderTargetData
needs identical dimensions + format on a system-memory target),
reuses the existing ConvertD3D9FormatToDXGI helper to land on a
DXGI format, builds a DirectX::Image pointing at just the
sub-rect inside the locked surface, and writes PNG / JPG / BMP
via DirectX::SaveToWICFile (DirectXTex is already linked). No new
dependency — the Resources::SaveTextureToFile path already uses
the same WIC pipeline for textures.
* ToolboxSettings::DrawSettingsCogButtons (renamed in spirit, kept
the symbol name for ABI continuity) now lays out the title-bar
overlay buttons from the right edge inward, drawing the cog first
and the camera one slot further left. The lambda factoring out
the per-button paint + click-test keeps the additional code
small. A click on the camera populates a PendingScreenshot struct
with the window's outer rect, the destination path, and
GetFrameCount()+1 as the capture frame.
* On the deferred capture frame, IsScreenshotInFlight() short-
circuits the title-bar overlay entirely so neither the cog nor
the camera appears in the saved PNG. GWToolbox::Draw calls
ToolboxSettings::FlushPendingScreenshot(device) immediately after
ImGui_ImplDX9_RenderDrawData, which is the first point at which
the back buffer actually contains the freshly-rendered Toolbox
windows.
* Output filenames are gwtoolbox_<slug>_<yyyymmdd-hhmmss>.png under
Resources::GetPath("Screens"). The slug is the window's Name()
lowercased with non-alnum runs collapsed to underscores, so
e.g. "Hero Builds" -> "hero_builds".
Known limitation: multi-viewport mode (ConfigFlags_ViewportsEnable)
with a Toolbox window docked out into its own OS window won't work —
we only read back the main GW back buffer. That's fine for the
intended docs-authoring use case.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ImGui::ShowHelp("Show a "ICON_FA_CAMERA" button in the title bar of each window.\nClick it to save a PNG of just that window to the Toolbox Screens folder.\nIntended for capturing screenshots for documentation or bug reports.");
0 commit comments