Fixes the papercut: the generated frame loop called rt_poll() (feeding only Input.key) but never input_poll(), so Input.active/key_down/mouse/pad read empty unless the game called Input.poll() by hand. The loop now calls input_poll() when the game uses any Input runtime method — committing the held-key/mouse/gamepad state, and record/replay — and stores its return as the frame key so Input.key still works. A game using no Input runtime keeps the plain rt_poll path, byte-identical. Adds the Input-Manager API: Input.action(name,key) ships a default binding (kept if already bound, so a rebind/loaded map isn't clobbered), Input.bind_pad(name,button) makes an action device-agnostic (keyboard OR pad), and Input.active/just_pressed/just_released read the multi-key device layer with clean on-press/on-release edges (deterministic, dispatch-free — a handler polls the edge; a replay fires identically). Examples input_manager + input_auto, 5 docs pages. Full suite 107/0, goldens byte-identical, fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
859 B
859 B
id: input-just_pressed name: Input.just_pressed category: input kind: namespace-method tokens: Input.just_pressed sig: Input.just_pressed(action: str) -> bool tip: Did a named action go active this frame (the deterministic on-press)? order: 34 ns: Input member: just_pressed
Returns whether a named action went active this frame — active now, not active last frame. This is the deterministic on-press edge over the device layer (keyboard or pad), the event-style "just pressed" without a callback: a handler polls it each frame and reacts. Pair with Input.just_released for the release edge and Input.active for the held state.
program Press {
entry {
Input.action("jump", ' ')
if Input.just_pressed("jump") { print(1) }
}
}