← ClaudeAtlas

inputlisted

Taps, drags, pinch-zoom, keyboard and camera control in an isometric game. Use for tap to place or select, drag to pan, pinch or wheel to zoom, a placement ghost that follows the pointer, key bindings, "nothing happens when I tap", a tap that hits the wrong thing or the building behind, taps that land uphill or downhill of the finger, or a tile coordinate that comes back NaN.
C-Aniruddh/lattice · ★ 37 · AI & Automation · score 74
Install: claude install-skill C-Aniruddh/lattice
# Input Every way a person can touch a game — finger, mouse, pen, key — arrives as **one replayable stream of intents in tile coordinates**, bucketed to simulation ticks, behind one object that unbinds all of it. The two properties that shape everything else: - **Input never learns what is in the world.** There is no registry, no rect, no `pickable` flag and no hit callback — so an implementation that caches hit boxes during the draw pass cannot be built on it, because there is nowhere to put them and nothing that would read one. (In the source game that cache made every collect bubble untappable in a backgrounded tab.) `terrain` is not an exception: a heightfield is the shape of the *ground*, a parameter of the projection in the same sense the camera is, and no hit box can be stored in one or recovered from it. - **Gestures are delivered on simulation ticks, never on frames.** So a tap cannot be dropped by a slow frame or fired twice on a fast one. --- ## The five lines a game writes ```ts import { createInput } from '@latticekit/input'; import type { Camera, HeightField } from '@latticekit/iso'; import type { Loop } from '@latticekit/loop'; export function wire( canvas: HTMLCanvasElement, camera: Camera, loop: Loop, land: HeightField, maxHeightPx: number, ): void { const input = createInput({ element: canvas, camera, step: loop, // the loop itself, so the step cannot drift terrain: { field: land, maxHeightPx