Skip to content

Game Library: sharp canvases on 2x and 3x screens (190 games) - #115

Merged
juw12 merged 1 commit into
mainfrom
agent/gamelib-hidpi
Nov 21, 2026
Merged

juw12 merged 1 commit into
mainfrom
agent/gamelib-hidpi

Conversation

@juw12

@juw12 juw12 commented Nov 21, 2026

Copy link
Copy Markdown
Owner

From the sharpness scan (Cairn decision mac-0015, handoff of 21 Nov): 252 games draw into a fixed-size canvas that CSS stretches, soft on 2x-3x screens.

  • web/hidpi.js (new, no dependencies): on-screen 2D canvases get a backing store of up to 2x; canvas.width, mouse maths, setTransform, shadows, isPointInPath and drawImage of the canvas keep the game's own units. Off-screen buffers and WebGL are left alone; data-hidpi="off" opts a canvas out.
  • One line, <script src="hidpi.js"></script>, before the first script of 190 games.

How the 190 were chosen (headless Chrome, 1280x800 at 2x): each candidate was played three times by a script with fixed random numbers and a virtual clock (same taps, keys and start button): plain, plain again, with the script. Kept only when the two plain runs were identical, the picture with the script matched at four moments, the canvas and page had the same position and size, the backing store was 2x, there was no new script error, and the play-through left the first screen.

Also checked after the edit: all 190 pages open at desktop 2x and iPhone 3x with a 2x canvas and no script error; canvas position and size on a phone, upright and sideways, identical to before (380 page views, 0 differ); apps/gamelib/tests 9 tests OK.

Not included: 48 whose scripted play-through never left the first screen, 12 pixel-art, 4 that read pixels back. Not checked by a person playing or on a physical phone.

…s fixed-size 2D canvases a 2x backing store; added to the 190 games where a deterministic play-through drew the same picture and layout with and without it
@juw12
juw12 merged commit 3cd48a5 into main Nov 21, 2026
2 checks 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