acron.input_map

Input map – Godot-style action queries over Acron’s input state.

Define the actions as plain data at construction (read them from a vendored project.godot with acron.gdformat.project.parse_project_actions(), or author them directly):

input = InputMap(
    base,
    held={
        "move_left": ["a", "arrow_left"],
        "move_right": ["d", "arrow_right"],
        "move_forward": ["w", "arrow_up"],
        "move_back": ["s", "arrow_down"],
        "aim": ["mouse3"],
        "shoot": ["mouse1"],
    },
    edges={"jump": ["space"], "quit": ["escape"]},
    edge_from_held=("aim", "shoot"),
)

Held actions use inputState.watch_with_modifiers and are polled with is_action_pressed (== Godot Input.is_action_pressed). Edge actions are latched via accept and read with is_action_just_pressed. Held actions named in edge_from_held additionally get just-pressed / just-released edges derived by diffing held state across calls to update_edges().

The bindings can change at runtime (a controls screen): rebind() gives one action a new key list – the old watches are released, the edge listeners re-fanned – and bindings() reads the whole table back. Whether an action is held or edged is fixed at construction; only its keys move. KeyCapture is the other half of a rebinding screen: the next button pressed, whatever it is, through the window’s ButtonThrower general button-down event (modifier prefixes stripped, bare modifiers and the wheel ignored) – and driven by messenger.send(KeyCapture.EVENT, [name]) where there is no window to press a key in.

Manage edges in ONE place at ONE cadence. Decide whether input is read in the fixed step or per render frame and clear edges there only – if both a fixed loop and a per-frame process clear the just-pressed set, edges get dropped or double-fired (missed jumps, aim flicker). acron.fixed_loop.GameLoop calls end_step() after each fixed step when given this object, so just-pressed flags live exactly one step.

Mouse look keeps the cursor in M_absolute (hidden) and recenters each frame itself – M_relative is inconsistent across platforms. Window Y grows downward (top-left origin), so negate dy if mouse-down should look down.

InputMap(base[, held, edges, ...])

Godot-style action queries (held + one-step edges) over Acron's input state.

KeyCapture(base, on_key, *[, cancel, ignore])

The next button pressed, whatever it is -- a rebinding screen's ear.