Skip to content

Commit 8b0a860

Browse files
author
DavidQ
committed
BUILD_PR_CANVAS_DEBUG_OVERLAY_RENDERER
- Added canvas-based debug HUD renderer - Wired HUD draw into sample-level dev console integration - Rendered overlay after gameplay with existing combo-key controls
1 parent ea0dc15 commit 8b0a860

File tree

10 files changed

+374
-25
lines changed

10 files changed

+374
-25
lines changed

docs/dev/CODEX_COMMANDS.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,29 @@ MODEL: GPT-5.4-codex
77
REASONING: high
88

99
COMMAND:
10-
Update dev console integration to replace F-key bindings with combo-key bindings.
10+
Create BUILD_PR_CANVAS_DEBUG_OVERLAY_RENDERER implementation.
1111

12-
- Shift + ` => toggleConsole
13-
- Ctrl + Shift + ` => toggleOverlay
14-
- Ctrl + Shift + R => reload
15-
- Ctrl + Shift + ] => next panel
16-
- Ctrl + Shift + [ => previous panel
12+
Requirements:
13+
- Create tools/dev/canvasDebugHudRenderer.js
14+
- Update tools/dev/devConsoleIntegration.js to use the HUD renderer
15+
- Modify ONE sample/dev entry file only
16+
- Draw debug HUD on canvas after world rendering
17+
- Keep combo keys exactly as currently implemented:
18+
- Shift + ` => toggle console
19+
- Ctrl + Shift + ` => toggle overlay
20+
- Ctrl + Shift + R => reload
21+
- Ctrl + Shift + ] => next panel
22+
- Ctrl + Shift + [ => previous panel
23+
- No engine core changes
24+
- No F-key bindings
25+
- Use save()/restore() around canvas mutations
26+
- Keep commit_comment.txt header-free
27+
- Run node --check on touched JS files
28+
- Package implementation output to:
29+
<project folder>/tmp/BUILD_PR_CANVAS_DEBUG_OVERLAY_RENDERER_delta.zip
1730

18-
Remove all F-key bindings.
19-
20-
Keep changes isolated to devConsoleIntegration.js
21-
Do not modify engine core
31+
Report back:
32+
- exact files changed
33+
- sample file selected
34+
- how HUD draw is invoked
35+
- validation command results

docs/dev/COMMIT_COMMENT.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
BUILD_PR_DEBUG_COMBO_KEYS_PATCH
1+
BUILD_PR_CANVAS_DEBUG_OVERLAY_RENDERER
22

3-
- Replaced F-key bindings with browser-safe combo keys
4-
- Added Shift+` and Ctrl+Shift+` toggles
5-
- Removed conflicting browser shortcuts
3+
- Added canvas-based debug HUD renderer
4+
- Wired HUD draw into sample-level dev console integration
5+
- Rendered overlay after gameplay with existing combo-key controls

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
APPLY_PR_DEBUG_COMBO_KEYS_PATCH
1+
APPLY_PR_CANVAS_DEBUG_OVERLAY_RENDERER

docs/dev/change_summary.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
Replaced F-key debug bindings with combo keys for browser compatibility
1+
Toolbox Aid
2+
David Quesenberry
3+
04/05/2026
4+
change_summary.txt
5+
6+
Summary
7+
- Added BUILD PR for a real on-canvas debug HUD
8+
- Scoped implementation to tools/dev plus one sample entry
9+
- Preserved combo-key debug controls
10+
- Preserved docs-first workflow and commit_comment no-header exception

docs/dev/file_tree.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
docs/pr/... docs/dev/... tools/dev/devConsoleIntegration.js
1+
Toolbox Aid
2+
David Quesenberry
3+
04/05/2026
4+
file_tree.txt
5+
6+
docs/pr/BUILD_PR_CANVAS_DEBUG_OVERLAY_RENDERER.md
7+
docs/dev/codex_commands.md
8+
docs/dev/commit_comment.txt
9+
docs/dev/change_summary.txt
10+
docs/dev/validation_checklist.txt
11+
docs/dev/file_tree.txt
12+
docs/dev/next_command.txt

docs/dev/validation_checklist.txt

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
1-
Combo keys work, no F-keys remain, no browser conflicts
1+
Toolbox Aid
2+
David Quesenberry
3+
04/05/2026
4+
validation_checklist.txt
5+
6+
VALIDATION CHECKLIST
7+
8+
Workflow
9+
- BUILD_PR created
10+
- One PR per purpose
11+
- Commit comment has no header
12+
13+
Implementation Targets
14+
- tools/dev/canvasDebugHudRenderer.js created
15+
- tools/dev/devConsoleIntegration.js updated
16+
- one sample entry updated
17+
18+
Functional
19+
- Shift + ` toggles console state
20+
- Ctrl + Shift + ` toggles HUD visibility
21+
- Ctrl + Shift + R triggers reload action
22+
- Ctrl + Shift + ] moves to next panel
23+
- Ctrl + Shift + [ moves to previous panel
24+
- HUD draws on canvas after gameplay/world rendering
25+
- HUD survives missing diagnostics safely
26+
27+
Safety
28+
- No engine core files modified
29+
- No F-key bindings remain
30+
- Canvas save/restore used
31+
- No duplicate listeners/runtime instances after repeated init/reload
32+
33+
Validation Commands
34+
- node --check tools/dev/canvasDebugHudRenderer.js
35+
- node --check tools/dev/devConsoleIntegration.js
36+
- node --check <selected sample file>
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
Toolbox Aid
2+
David Quesenberry
3+
04/05/2026
4+
BUILD_PR_CANVAS_DEBUG_OVERLAY_RENDERER.md
5+
6+
# BUILD PR
7+
Canvas Debug Overlay Renderer
8+
9+
## Objective
10+
Build a real visual HUD for the existing dev console/debug overlay system and wire it into one sample so the overlay renders on-canvas inside the running game.
11+
12+
## Scope
13+
- Create a dedicated canvas HUD renderer file
14+
- Wire the HUD renderer into the existing sample-level dev console integration
15+
- Render overlay content after gameplay/world rendering
16+
- Reuse existing overlay diagnostics and panel state from the current debug runtime
17+
- Keep implementation isolated to tool/dev + one sample integration target
18+
19+
## Required Outputs
20+
Codex must produce implementation code and the implementation delta ZIP at:
21+
<project folder>/tmp/BUILD_PR_CANVAS_DEBUG_OVERLAY_RENDERER_delta.zip
22+
23+
## File Targets
24+
Expected implementation focus:
25+
- tools/dev/canvasDebugHudRenderer.js
26+
- tools/dev/devConsoleIntegration.js
27+
- one sample entry file only
28+
- optional test file if needed for renderer validation
29+
30+
## Implementation Requirements
31+
32+
### 1. New HUD renderer
33+
Create:
34+
tools/dev/canvasDebugHudRenderer.js
35+
36+
Responsibilities:
37+
- accept a 2D canvas context and overlay data
38+
- render a lightweight translucent HUD panel
39+
- draw title + section headers + line items
40+
- support current/active panel highlighting
41+
- support compact layout with predictable padding
42+
- render safely even when some diagnostics are missing
43+
- remain dependency-free
44+
45+
### 2. Wire into existing integration
46+
Update:
47+
tools/dev/devConsoleIntegration.js
48+
49+
Requirements:
50+
- import canvasDebugHudRenderer.js
51+
- keep combo-key bindings already implemented:
52+
- Shift + ` => toggle console
53+
- Ctrl + Shift + ` => toggle overlay
54+
- Ctrl + Shift + R => reload
55+
- Ctrl + Shift + ] => next panel
56+
- Ctrl + Shift + [ => previous panel
57+
- expose a method that draws the HUD onto a provided canvas context
58+
- preserve sample-safe boundaries
59+
- do not move logic into engine core
60+
61+
### 3. Sample wiring
62+
Modify ONE sample/dev entry file only.
63+
64+
Requirements:
65+
- initialize integration once
66+
- collect diagnostics in the loop
67+
- draw world/game first
68+
- draw debug HUD last
69+
- ensure repeated toggles do not duplicate listeners or runtime instances
70+
71+
## HUD Rendering Rules
72+
- Render last in frame order
73+
- Default position: top-left
74+
- Use readable mono or browser-safe default font
75+
- Use translucent dark background
76+
- Use contrasting text
77+
- Keep dimensions adaptive to content
78+
- Avoid touching gameplay transforms/camera transforms
79+
- Use save()/restore() around canvas state mutations
80+
- Do not assume fullscreen
81+
- Do not require HTML DOM overlay
82+
83+
## Minimum Visible Content
84+
HUD should visibly support:
85+
- Runtime
86+
- Frame
87+
- Scene
88+
- Camera
89+
- Entities
90+
- Render
91+
- Tilemap
92+
- Input
93+
- Hot Reload
94+
- Validation
95+
96+
## Non-Goals
97+
- No engine renderer rewrite
98+
- No DOM-based console window
99+
- No CSS/HTML overlay framework
100+
- No broad sample migrations
101+
- No debug system spread across engine modules
102+
103+
## Acceptance Criteria
104+
- Sample still runs normally
105+
- Shift + ` toggles console state
106+
- Ctrl + Shift + ` toggles HUD visibility
107+
- HUD draws on canvas
108+
- HUD renders after gameplay content
109+
- Panel navigation works
110+
- Missing diagnostics do not crash rendering
111+
- No F-key bindings remain
112+
- No engine core files modified
113+
114+
## Validation
115+
- node --check on all touched JS files
116+
- run sample manually
117+
- verify HUD visible on canvas
118+
- verify combo keys work
119+
- verify reload combo does not browser-refresh the page
120+
- verify panel cycling updates visible section focus
121+
- verify no duplicate event listeners after reload/reinit
122+
123+
## Risks
124+
- Canvas state leakage
125+
- overlay drawn before game content
126+
- integration duplicates runtime
127+
- browser key conflict regressions
128+
129+
## Rollback
130+
If instability appears:
131+
- disable HUD draw call in sample
132+
- keep runtime logic intact
133+
- preserve combo key system

samples/Phase 12 - Demo Games/Demo 1205 - Multi-System Demo/MultiSystemDemoScene.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ export default class MultiSystemDemoScene extends Scene {
187187
const worldStages = ['parallax', 'tilemap', 'entities', 'sprite-effects', 'vector-overlay'];
188188
const renderOrder = this.devConsoleIntegration?.getRuntime?.().getDeterministicRenderOrder(worldStages) || worldStages;
189189
this.lastResolvedRenderOrder = renderOrder.slice();
190+
const shiftDown = engine.input.isDown('ShiftLeft') || engine.input.isDown('ShiftRight');
191+
const ctrlDown = engine.input.isDown('ControlLeft') || engine.input.isDown('ControlRight');
192+
const backquoteDown = engine.input.isDown('Backquote');
190193

191194
return {
192195
runtime: {
@@ -214,8 +217,11 @@ export default class MultiSystemDemoScene extends Scene {
214217
left: engine.input.isDown('ArrowLeft'),
215218
right: engine.input.isDown('ArrowRight'),
216219
jump: engine.input.isDown('Space'),
217-
consoleToggle: engine.input.isDown('Backquote'),
218-
overlayToggle: engine.input.isDown('F3'),
220+
consoleToggle: shiftDown && !ctrlDown && backquoteDown,
221+
overlayToggle: ctrlDown && shiftDown && backquoteDown,
222+
reload: ctrlDown && shiftDown && engine.input.isDown('KeyR'),
223+
nextPanel: ctrlDown && shiftDown && engine.input.isDown('BracketRight'),
224+
previousPanel: ctrlDown && shiftDown && engine.input.isDown('BracketLeft'),
219225
},
220226
hotReload: {
221227
enabled: false,
@@ -244,7 +250,8 @@ export default class MultiSystemDemoScene extends Scene {
244250
'Gameplay contract matches Demo 1204 with one added collectible counter layer.',
245251
'Collectibles disappear on touch and increment the counter.',
246252
'No enemies, trigger/switch systems, or broader game systems.',
247-
'Debug: ` toggles console, F3 toggles overlay, F6/F7/F8/F9 run console commands.',
253+
'Debug: Shift+` console, Ctrl+Shift+` overlay, Ctrl+Shift+R reload.',
254+
'Debug Panels: Ctrl+Shift+] next panel, Ctrl+Shift+[ previous panel.',
248255
]);
249256

250257
renderer.strokeRect(this.screen.x, this.screen.y, this.camera.viewportWidth, this.camera.viewportHeight, '#d8d5ff', 2);
@@ -271,7 +278,7 @@ export default class MultiSystemDemoScene extends Scene {
271278
`Goal: ${complete}`,
272279
`Camera X: ${this.camera.x.toFixed(1)}`,
273280
`Parallax Far/Near: ${this.parallaxLayers[0].speed}/${this.parallaxLayers[2].speed}`,
274-
'Controls: Left/Right + Space + ` + F3',
281+
'Controls: Left/Right + Space + Shift+` + Ctrl+Shift+`',
275282
]);
276283

277284
if (this.devConsoleIntegration) {

0 commit comments

Comments
 (0)