Skip to content

feat(gamedebug): add overlay pause, step and time-scale controls - #2751

Open
houko wants to merge 4 commits into
mainfrom
feat/issue-1498-debug-overlay-controls
Open

houko wants to merge 4 commits into
mainfrom
feat/issue-1498-debug-overlay-controls

Conversation

@houko

@houko houko commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pkg/tooling/gamedebug's overlay wrapped a game.Loop but gave nobody a way to reach the loop's pause, single-step or time-scale controls, and no example or template constructed the overlay or console, so the tools were undiscoverable and untested in a real project. This binds F8 (and Pause/Break in a browser), F10, - and =/Shift+= on the scope the overlay attaches to, adds Pause/Resume, Step, Slower and Faster buttons to the panel for touch and mouse, and registers pause [on|off|toggle], step [n] and timescale [x] console built-ins when the console is given the loop. Cave Run and the starter template now attach the overlay and console, and the template shows a speed tunable and a reset command. Release builds keep compiling all of it to no-ops, and a release-tag test presses the control keys to prove the loop is untouched there.

Related issue

Fixes #1498

Verification

  • gofmt -l . produces no output
  • go tool nsgo check passes on the repository root, Cave Run and the starter template, and go tool nsgo check -target macos,windows,linux,web passes on the root, through ubuild
  • go tool nsgo test ./pkg/tooling/gamedebug passes in development and with -tags release, go tool nsgo test ./internal/gamecli -- -run 'TestTemplatesMatchTemplateModules|TestTemplateDebugConfigs' passes, and the Cave Run and template/template packages pass through ubuild
  • go tool nsgo test ./... was not run in full (the editor suite alone takes about 40 minutes); the affected packages above ran instead
  • go tool nsgo check -target ios,ios_simulator was not run; the remote build machine has no Xcode
  • bun run build was not run; website/ is untouched and only Markdown under docs/ changed
  • Both docs/en/ and docs/zh/ updated (gamedebug.md and loop.md)

Screenshots

Cave Run at 1920x1080 with F3 pressed.

Before, F3 shows no overlay because nothing attaches one:

Cave Run before: F3 shows no overlay

After, the overlay panel shows Running · 1x with the new Pause, Step, Slower and Faster controls, and the console sits below:

Cave Run after: the overlay panel with loop controls

After, paused, the readout changes to Paused · 1x and the pause button to Resume:

Cave Run after: the paused overlay

houko added 3 commits December 1, 2026 17:30
The overlay binds Pause/Break, F10, - and Shift+= on the scope it attaches to while wrapping a loop, shows Pause/Resume, Step, Slower and Faster buttons for touch, and registers pause, step [n] and timescale [x] console built-ins. Cave Run and the starter template attach the overlay and console, the template adding a speed tunable and a reset command. Docs and tests cover the step key, console time scale, panel buttons and release stubs.
Bind F8 alongside Pause/Break for pause: NSGo names the Pause/Break key "pause" only in a browser, so the pause binding never fired on native macOS, Windows or Linux; bind "=" alongside "shift+=" for faster because a browser reports Shift+Equal as the "+" key with Shift held, which no binding can express.

Add zero-cost release stubs for Overlay.Paused and Overlay.TogglePause so games compile against the same API in release builds.

Update the docs, changelog fragment and note, and cover the new defaults and rebinding in tests.
@houko
houko force-pushed the feat/issue-1498-debug-overlay-controls branch from 51bac56 to 05bcbcf Compare December 1, 2026 08:36
…oop state immediately

Mark debug-loop-controls and its button row PointerEventsBoxNone and wrap the read-only state text and telemetry/graph/inspector children in PointerEventsNone so clicks and touches over non-button overlay content truly pass through to the game on macOS, Web, iOS and Windows.

Also add a reactive loopSig bumped by Overlay pause/time-scale controls so the panel state readout and Pause/Resume label update immediately even on OnDemand loops where Draw does not run while paused, and reset keysBound when Attach moves to a new scope.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug: no example or template attaches the overlay, console or profiler, and the overlay has no pause, single-step or time-scale controls

1 participant