Skip to content

feat(website): mobile touch controls for the Parthenon example#31

Merged
apresmoi merged 1 commit into
mainfrom
feat/parthenon-mobile-controls
Jul 21, 2026
Merged

feat(website): mobile touch controls for the Parthenon example#31
apresmoi merged 1 commit into
mainfrom
feat/parthenon-mobile-controls

Conversation

@apresmoi

Copy link
Copy Markdown
Owner

Adds a touch game controller to the /examples/parthenon page so the first-person walkthrough is usable on phones (previously you could open FPV on mobile but couldn't walk or turn).

Everything in the controller is rendered by glyphcss itself — the joystick and buttons are ASCII, matching the scene.

What's new

  • Glyph joystick — a dim-cyan ring + bright knob rendered as its own glyph scene at a finer density than the temple. Drives synthetic WASD into the FPV controls (which walk without pointer-lock, which touch can't grant). Hand-rolled pointer-drag with window-level release + blur/visibility safety resets, so the stick never sticks when your finger leaves the pad.
  • Drag-to-look — since touch can't grab pointer-lock, dragging anywhere on the temple turns the camera (mirrors the FPV control's deriveTarget). Twin-stick: left thumb walks, a second drag looks.
  • Spinning cube buttonsM (previews the style you'll switch to: matrix ↔ marble cube) and C (label toggles FPV/ORBIT), each a themed, animated glyph cube.
  • Sidebar key hints (desktop) — M/C chips and a FPV legend (WASD / Space / Esc) that appears only while walking.
  • Touch detection — the pad is gated by JS (maxTouchPoints + coarse-pointer + mobile UA), not a CSS media query (many phones report hover: hover). ?pad=1 / ?pad=0 force it on/off for testing.

Notes

  • Website-only — no library/API changes, so no React/Vue mirror needed. The joystick + buttons flow through one page-local makeHudLayer(host, { cam, spin, onDrag/onEnd }) helper — a deliberate prototype of a future GlyphHudLayer (fixed per-layer camera + screen anchor + pointer routing) we can promote into glyphcss later.
  • Desktop behavior is unchanged (pad hidden; keyboard shortcuts + click-to-lock mouselook intact).

@apresmoi
apresmoi merged commit 2a51e5d into main Jul 21, 2026
1 check passed
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