towerDefenseKit.package
This package holds more than this page lists. See all of its files in its world.
README.md
towerDefenseKit.layoutCheck
Checks that the game's screens fit together in every look, on every kind of screen and input.
Run it in play (press Play first, on the deciding machine). In edit mode it refuses with "start a game first": the check switches the game's look fields as it goes, and in edit mode those would be changes to the scene itself. In play every change it makes stays in the play session, and when it ends (or fails partway) it puts the game's looks, the viewport size and the input device back, dismisses its messages and sells the tower it built. If no game is running (between games, or ended) it starts one, so there is a game to build in.
run() switches the build menu (bar, cards, minimal, ring), the wave preview (all six styles) and the lives display (all seven) one combination at a time, at desktop sizes (2560 x 1440, 1920 x 1080, 1366 x 768 and a short wide 1560 x 720), a tablet (2048 x 1536) and a phone held either way, and measures where everything landed on screen. It reports:
- any two pieces that overlap: the HUD's lives, gold and wave, the build menu, the wave preview, menusKit's pause button and, on touch, the engine's own round Menu button (drawn outside the UI, measured from
zinput.touchControls.layout()); - any piece that leaves the screen;
- any enemy icon of the dial preview that covers the dial's face;
- any two texts inside a build card that run into each other;
- any two enemy names in the strip preview that touch or overlap ("FOOTMENSHIELDBEARERS"), with the gap between them.
Texts are measured at their natural one-line width in a hidden probe screen (a fresh one each time), because a label's box is held to its room while its text can run past it.
Three input passes at every size:
- mouse and keyboard: every menu, preview and lives display;
- gamepad: every menu and preview with the gamepad's prompts showing;
- touch: three messages up (navUiKit toasts, whose rectangles come from navUiKit's own layout because they are painted, not laid out), one tower of its own built and tapped open, and the camera turn buttons checked against the tower panel's tap area (the largest box holding the panel, since an invisible row takes taps as surely as the panel), the messages and everything else, plus
ui.hitTeston where a tap on each turn button would land. A look change closes the panel, so it reopens it before each measurement.
Options: sizes, menus, previews, lives, settle (seconds per combination, default 0.6), full = true (every lives display with every menu and preview), gamepad = false, touch = false. Returns { checked, problems = { { shape, device, menu, preview, lives, a, b?, area?, missing?, offscreen?, tooClose?, gap? } } }.