Skip to content

Input

Keyboard, pointer, touch and gamepad state: game.get(Input) after adding the input() plugin.

gamepads: (Gamepad | null)[]

Connected gamepads (Gamepad API), refreshed each frame. With the standard mapping, buttons[0] is the bottom face button (A / cross), buttons[9] start, buttons[12..15] the d-pad (up, down, left, right) and axes[0]/axes[1] the left stick. Refreshed at the start of update.


keys: Set<string>

Pressed keys by KeyboardEvent.code (‘KeyA’, ‘Space’, ‘ArrowLeft’…).


pointer: Point & object

The last pointer (mouse, pen or finger) that moved, in screen pixels. down while any pointer is pressed.

down: boolean


pointers: Map<number, Point>

Every pressed pointer by pointerId, in screen pixels: one entry per finger for multi-touch controls.


pressed: Set<string>

What went down this frame only: key codes, 'Pointer' for a click or tap, and 'Button0'–'Button16' for gamepad buttons (any pad). For one-shot actions (jump, start, menu) without tracking the previous state yourself. Read it in update systems; it is cleared at the end of every frame.