Input
eff InputSourceReading the input devices, as an effect.
Input.poll returns the same value every time it is called within one simulation
step: the runtime captures it once, at the top of the frame, and freezes it. That is
what makes a run reproducible from a recorded list of snapshots.
Operations
Definitions
One frame's reading of the keyboard, spread over the n ticks it has to drive.
A frame does not map to a tick. The display runs at whatever rate the machine manages and the simulation runs at a fixed one, so a frame may owe several ticks or none.
Only the first tick gets the edges. A press is a transition, and handing the same
pressed set to three catch-up ticks fires it three times -- which for anything
edge-triggered means the action happens once per stalled frame instead of once per
press, and for anything that toggles means it can end up back where it started.
The rest of the ticks keep the keys held, because holding is a state and does last.
Builds a snapshot by comparing the keys held now against the keys held last step.
The two sets are named because transposing them inverts every edge, turning presses into releases.
Interprets Input by answering every poll with the same snapshot.
Like Canvas, this deliberately has no @DefaultHandler: a default of "no keys
held" would let a test that forgot to supply input pass while asserting on a world
nobody played.
A snapshot with keys held, and all of them treated as newly pressed.
Convenience for tests and scripted replays.
Runs f, answering every Input.poll with the same snapshot.
The same snapshot with its edges removed: still held, but pressed and released nothing.