Skip to content

Add the HUD and photo mode to the golden_line example - #357

Merged
ASDAlexander77 merged 1 commit into
mainfrom
golden-line-hud
Dec 5, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
golden-line-hud

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Ports the original's HUD (src/ui/hud.js) and photo mode into the golden_line example.

What's in

  • HUD (core/golden_line_hud.ts): the clock and time of day, the weather, the next station with its distance and approach line, the speed gauge (14 ticks), the buttons with their tooltips, the camera/controls label and the photo-mode toast.
  • Drawing: text goes through ImGui using the page's fonts (Palatino, Segoe UI, Segoe UI Semibold), with Open Sans as the fallback. Shapes (corner shades, rules, gauge, icons, boxes) go through one full-screen pass (shaders/golden_line_hud.hlsl). That pass takes the blit's place and blends in sRGB-encoded values, the way the page blends; where no shape covers, the frame passes through unchanged. The back buffer is SRGBA8, so ImGui's text colours are linearized.
  • Controls:
    • H or the photo button hides everything for photo mode; a click or Escape brings it back.
    • / shows the controls; 1–5, C and D show the camera label.
    • -nohud turns the HUD off; -hud draws the whole HUD in a -test still (that frame isn't checked).
  • Interop: Donut_ImGuiCreateFont returns null for a missing font file instead of a dangling pointer.

Verification

  • Logic: the clock, phase, weather, distance text and station finder print output identical to hud.js run under node (1060 lines).
  • Layout: shades within 1 level and text within 1–2 px of the original page (grey-background capture).
  • Builds and tests: gc, own and rc build; ctest -R golden_line passes 6/6.
  • No change without the HUD: test frames are byte-identical to before (7 views × 3 builds).
  • -hud stills: identical across gc, own and rc; Vulkan and D3D12 debug layers clean.

Known gaps

  • Pointer lock, touch, the small-screen and zoom media queries, and the idle cursor aren't ported.
  • The 18 px text glow is approximated with offset copies of the text.
  • Sound isn't ported: the sound button is shown disabled, and the M key and the HUD's sound states are absent.
  • Interaction was tested headless only, not in a live window.

🤖 Generated with Claude Code

Port hud.js: the clock and phase of the day, the weather, the next
station with its distance and approach line, the speed gauge, the
buttons and their tips, the camera label and the photo toast. Words go
through ImGui with the page's fonts and metrics; the shapes go through a
full-screen pass that lays them over the frame in sRGB-encoded values,
as the page blends, in place of the blit (the back buffer is SRGBA8).
H or the photo button hides it all, a click or Escape brings it back,
and / shows the keys; -nohud turns it off, -hud shows it in a -test
still. Donut_ImGuiCreateFont returns null for a missing font file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 0249b55 into main Dec 5, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the golden-line-hud branch December 5, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant