Follow-up to #7: input device layer — multi-key held state, gamepads, touch, analog axes/vectors #50
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #7, which shipped the two ideas that proposal leads with — action maps ("gameplay reads actions, not keys") and deterministic record/replay ("free, exact replays and lockstep netcode") — in
377b6d1.Input.bind/down/pressed/rebindgive named, runtime-rebindable actions;Input.poll/record/replaygive the single per-frame read and exact playback. All integer and deterministic, over the single-key poll (Input.key/rt_poll) every target already provides. Seeruntime/native/input.ludic, the sevendocs/language/input/pages, andexamples/library/input_actions.ludic.This tracks the raw device layer the proposal also sketches, all of which needs a platform key-state backend (keydown + keyup into a held-key set) rather than the current one-key-per-frame poll — so it is a runtime/platform job across the Cocoa, headless, and wasm targets, not a pure-Ludic addition:
Input.key_down(k)/key_pressed/key_releasedand simultaneous keys (hold left and jump), which the single-key poll can't express. This is the prerequisite for the analog reads below.Input.action_strength,Input.axis, andInput.vector(left,right,up,down)with deadzones — need simultaneous keys.Input.mouse_pos/mouse_delta/mouse_down/wheel.Input.pad_button/pad_axis/pad_stick/pad_trigger, hotplugPadConnected/PadDisconnected, SDL-style standard names — a new platform binding.Input.touch_count/touch(i), tap/hold, gestures.Related: #7 (the shipped action-map + replay core).
Shipped in
53bb441(feat(input): raw device layer, #50). The raw device layer over the action maps + record/replay of #7. The held set is fed by the platform when windowed (cocoa.ll now tracks keyDown/keyUp + mouse) and by a Godot-style injection API (Input.press/Input.set_mouse/Input.set_pad/Input.set_touch) on every target — what a replay, an AI, or the network feeds — so the whole layer is deterministic and headless-testable.Input.key_down(k)/key_pressed/key_releasedover a 256-bit held-key set, with clean rising/falling edges — hold left and jump at once. This was the named prerequisite, and it drives everything below. Native: cocoa.ll tracks keyDown/keyUp into@W_held(win_held), gated so headless builds DCE the native calls.Input.axis(neg, pos)(digital -1..+1),Input.vector(left, right, up, down)normalized so diagonals aren't faster (each component 0.7071), andInput.strength(action).Input.mouse_x/y,Input.mouse_dx/dy(per-frame delta),Input.mouse_down(btn),Input.wheel(). Native mouse buttons + wheel come from the Cocoa event pump (win_mouse);Input.set_mouseinjects on any target.Input.record/replaynow snapshot the full per-frame device state (held set + mouse), extending #7's single-key tape — a recorded run reproduces the exact multi-key state.Input.pad_connected/pad_button/pad_axis(SDL-order buttons, -1..+1 sticks) fed byInput.set_pad— and is deterministic and testable today (replay / AI / network). The native GameController.framework binding (real device reads + hotplugPadConnected/PadDisconnectedevents) feeds the same injected state and is the remaining OS-glue.Input.touch_count/touch_x/touch_yfed byInput.set_touch— with the native touch-device binding (NSTouch, tap/hold/gesture recognition) as the remaining OS-glue on top of the same state.Worked example + regression:
examples/library/input_device.ludic(1 1 0 1 0 1 71 -71 5 1 3 1 2 1 0 0 1, injection-driven headless). 23 new docs pages. Full suite 78 passed, self-host C-free fixpoint intact, no golden drift; cocoa.ll assembles and a windowed build links.Closing: the software device layer, its semantics and full-state replay are complete and deterministic on every target. Filing the two native hardware bindings (GameController / NSTouch), which just feed the injected state above, as a focused platform follow-up.