Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind

The overlay becomes engine: 2D drawing tools behind the door, and the range draws through them #60

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`src/engine/overlay.ts` takes the generic half of both games' 2D behind the door: `Paint` — the range's structural target widened by the five members the shooter's HUD also names (`textAlign`, `globalAlpha`, `arc`, `rect`, `fill`), still structural, so a recording stub is one and a real context fits without a cast — and `overlay(paint, width, height)`, which builds the tools once per resize and al…

shipped production is serving it deploy ae07c2d

opened this

src/engine/overlay.ts takes the generic half of both games' 2D behind the door: Paint — the range's structural target widened by the five members the shooter's HUD also names (textAlign, globalAlpha, arc, rect, fill), still structural, so a recording stub is one and a real context fits without a cast — and overlay(paint, width, height), which builds the tools once per resize and allocates nothing per call: scale (width / 1280 clamped to 0.7–1.4, which is src/client/hud.ts's clamp to the number, with a comment saying so), pad, font, panel, text (align, font, fill, alpha, and globalAlpha back at 1 whatever happened), crosshair, bar, columns and clock. Not one colour, team, phase or word from either game is in it; overlay.test.ts checks every one of those with no browser in the room.

src/range/readout.ts is the consumer that proves it: its scrim, its eight lines and its crosshair go through the tools, and its Paint is imported from the door and re-exported so main.ts and its tests keep the name. The readout's own tests pass unchanged. Two small behaviour notes worth a look: the crosshair strokes each arm from its outer end in to the gap (so a gap of zero is the plain cross the range always drew, and the range's existing assertion about where an arm starts still holds), and the readout's margin is now the engine's pad, never under 12 px rather than 10 — the same number above 600 px wide, two pixels kinder below it. src/client/hud.ts is not opened here; that half stays #18, and when it moves it is a move, not a retune.

bun test is green (392 pass) and both bundles are rebuilt and committed. The range is now 12,548 raw / 5,726 gzipped against its 12,800 / 5,800 ceiling — held, but with ~250 raw bytes left, because a tool set is bundled whole; scripts/build.ts says so and says the next range feature will want that ceiling raised. Two things landed in passing that were not mine to invent: boundary.test.ts's SURFACE gains the three names (no new rule or exemption, just the pinned list), and GUIDE.md's quote of src/client/main.ts was stale since #56 renamed the scene canvas — it was red on this branch's base and is fixed here. To try it: /range in the preview — the panel, its numbers and the crosshair are drawn by the engine now and should look exactly as they did.

🤖 Generated with Claude Code

Closes #49

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs