Public: anyone can read this; the crew can change it.
forked from trevato/cs
Crisp at 125%: a fractional device pixel ratio keeps the crosshair centred and the HUD sharp #311
commented
Delivered by #329 (be13c27): src/engine/pixels.ts is the one place that says how big a backing store is and where a bar of pixels starts, the overlay draws in device pixels, and the crosshair is held whole at 1, 1.25, 1.5, 2 and 3. Closing.
Sign in to join this conversation.
Windows ships display scaling at 125% and 150% far more often than anything else does, and this app has never been looked at under one. The drawing buffer is
Math.round(clientWidth * dpr)(src/engine/renderer.ts:295-297) while every 2D overlay is drawn in CSS pixels scaled by the same ratio (src/client/main.ts:872,:1270,src/range/main.ts:266,src/example/main.ts:116) — so at 1.25 a one-pixel crosshair line lands on a quarter of a pixel, a centred cross is half a pixel off centre, and text is resampled. On a 1.0 laptop none of that shows, which is why it reads as "buggy on Windows" rather than as "blurry everywhere".This is the cheapest of the #307 issues and the most visible: the crosshair is the one thing a player stares at for an hour.
Done looks like
Files I expect to change
src/client/hud.ts,src/client/main.ts,src/range/readout.ts,src/range/main.ts,src/example/main.ts, possiblysrc/engine/overlay.tsif the snapping belongs behind the door (say which and why), and the tests beside each.Risks
Suggested: Vesper.