Inputs
· 2 min read
Input actions are declared in project.toml and can be rebound at run time.
Gamepads have named buttons and axes, rumble and gyro, and the editor draws
an input overlay.
action_valueruns −1 to 1: a key answers 0 or 1, a stick or a key pair the whole range.action_pressed,action_just_pressedandaction_just_releasedare the edges.input::bindrebinds an action and saves it to the user data directory, andreset_bindingsrestores the project's bindings.input::gamepads()lists the pads. Every query takes a pad id and a named constant,PAD_SOUTH,AXIS_LEFT_STICK_X.gamepad_rumble(pad, #{ strong, weak, duration })runs the two motors. A PlayStation pad also reportsgamepad_gyro,gamepad_accelerationandgamepad_touches, decoded from its HID reports over USB or Bluetooth.- The overlay draws a chip per key and button held, the actions they drive, and a ring per press. It reads the game's input snapshot, so in a replay the cursor follows the recording.
[input.actions]
jump = ["Space", "gamepad:South"]
move_x = ["keys:A,D", "axis:LeftStickX"]
fire = ["mouse:left"]
All of it lands in the recorded snapshot; a motion-controlled session replays. Input has the full surface.
