Add zoom steps and a larger start caption to the game link (#266)
The released game only ever zoomed in whole steps up to 400%, so a small camera on a large screen stayed far smaller than it could be. The "Click to play" caption was drawn in the 11 px panel title size and was easy to miss. - GAME_SCALE_STEPS gains 300%, 500% and 600%. The game tab picker, Auto in the editor and the game link all read the same list. - The start caption takes its size from the new Theme.captionSize (16) instead of a constant in GameScreen. - The player page keeps the default arrow cursor at all times. It no longer switches to the hand over the caption. Tests: - view.test: Auto for 320x180 in 2000x2000 is now 6, with cases for 3 and 5. play-settings.test takes 2.5 and 8 as invalid steps. - e2e 60 checks the caption against the panel title size and the arrow cursor before and after the start. Module 03 follows the new step list. - ./check.sh 2808 tests, CHECK EXIT 0 (before the last Theme tweak, which changes no test). Full e2e run ALL PASSED, 1574 checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4194f3e150
commit
24d360aeec
8 files changed
+40
-9
No files matched your search
@@ -355,7 +355,7 @@ export async function play(t) {
|
||||
JSON.stringify(g),
|
||||
);
|
||||
g = await pickScale('Auto');
|
||||
const auto = Math.max(0.25, ...[0.25, 0.5, 1, 2, 4].filter((step) => step <= fit));
|
||||
const auto = Math.max(0.25, ...[0.25, 0.5, 1, 2, 3, 4, 5, 6].filter((step) => step <= fit));
|
||||
check(
|
||||
'auto takes the largest step that still fits',
|
||||
g.mode === 'auto' && g.factor === auto && g.label === `Auto · ${auto * 100}%` && g.frame.w === 640 * auto,
|
||||
|
||||
@@ -7,7 +7,7 @@ const UPDATED = 'Release 60 updated';
|
||||
// Not a 16:9 multiple of the window on purpose: fitting it would need a scale between the steps.
|
||||
const CAMERA = { width: 300, height: 180 };
|
||||
/** The zoom steps of the game view (`GAME_SCALE_STEPS`); Auto takes the largest that fits whole. */
|
||||
const STEPS = [0.25, 0.5, 1, 2, 4];
|
||||
const STEPS = [0.25, 0.5, 1, 2, 3, 4, 5, 6];
|
||||
const RED = '#e0553f';
|
||||
const BACKGROUND = '#22252c';
|
||||
|
||||
@@ -206,6 +206,8 @@ export async function release(t) {
|
||||
title: await json('document.title'),
|
||||
editor: await json('typeof window.__gm'),
|
||||
running: await player('running()'),
|
||||
captionHeight: (await player('screen()')).captionHeight,
|
||||
cursor: await json(`getComputedStyle(document.querySelector('canvas')).cursor`),
|
||||
};
|
||||
check(
|
||||
'the link opens without a session: only the game, on the page colour, waiting for a click',
|
||||
@@ -215,6 +217,13 @@ export async function release(t) {
|
||||
page.running === false,
|
||||
JSON.stringify(page),
|
||||
);
|
||||
// The panel titles are 11 px; the caption is set at Theme.captionSize (16). The page keeps the
|
||||
// arrow throughout – Pixi writes `default` as `inherit`, so read what the browser makes of it.
|
||||
check(
|
||||
'"Click to play" is set larger than the panel titles, under the arrow',
|
||||
page.captionHeight >= 16 && ['auto', 'default'].includes(page.cursor),
|
||||
JSON.stringify(page),
|
||||
);
|
||||
|
||||
// 60d. A click starts it in the start scene, zoomed to Auto: a whole number of pixels per unit.
|
||||
const size = { w: await json('innerWidth'), h: await json('innerHeight') };
|
||||
@@ -240,6 +249,12 @@ export async function release(t) {
|
||||
JSON.stringify({ size, auto, screen, pixels, log: await player('log()') }),
|
||||
);
|
||||
await shot('60-release-playing');
|
||||
const playingCursor = await json(`getComputedStyle(document.querySelector('canvas')).cursor`);
|
||||
check(
|
||||
'over a running game the cursor is still the arrow',
|
||||
['auto', 'default'].includes(playingCursor),
|
||||
playingCursor,
|
||||
);
|
||||
|
||||
// 60e. The keys go to the game: the arrow moves the crate out of the middle, S stops the game.
|
||||
await holdKey('ArrowRight', 500);
|
||||
|
||||
Reference in new issue
Block a user