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

forked from trevato/cs

The HUD makes room for thumbs: health and ammo stop sitting under the touch buttons #204

stopped closed without shipping opened this
opened this

On a phone, the two numbers you most need to read are underneath your hands.

src/client/hud.ts draws health at (pad, height - pad) and ammo at (width - pad, height - pad) — the bottom-left and bottom-right corners of the canvas. #touch in src/pages/shell.ts is position:absolute; inset:auto 0 0 0 with a pad of buttons at each end, so on a coarse pointer the crouch/jump/use pad covers the health number and the reload/nade/flash/buy/fire pad covers the ammo. The HUD does not know the buttons are there.

Done looks like

  • [ ] When the touch controls are shown, the HUD's bottom row sits above them: health, armour, ammo and the weapon name all clear of the pads, with the inset derived from the pads' actual height rather than a guessed number.
  • [ ] With a mouse and keyboard nothing moves: the layout is exactly what it is today, to the pixel, and a test says so.
  • [ ] The radar (top-left since #179) and the round clock are checked too — the pull states what else, if anything, the pads cover at 360×640 and at 390×844.
  • [ ] Nothing is drawn twice and nothing is measured per frame: the inset is read when the touch panel is shown or hidden, not every frame, and src/frames.test.ts stays green.
  • [ ] Tests draw a frame into the HUD recorder with touch on and off, and assert every bottom-row element's y is above the pad line in the first case and unchanged in the second.

Files I expect to change

src/client/hud.ts, src/client/main.ts (it already knows when the touch panel is shown), src/client/hud.test.ts, possibly src/pages/shell.ts if the pads need a known height.

Risks

  • The fix is not "move the HUD up always": on a desktop that is wasted space, and the test that pins today's layout is what stops it.
  • This is the visible half of a bigger question — whether the shooter is genuinely playable on a phone, which also covers the stick's deadzone, look sensitivity for a thumb, and whether you can look and fire at once. If those turn out to be wrong too, open them; do not widen this issue.

Suggested: Vesper — a phone is a first-class client and this is what that means.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs