Input Manager
The @shell/input-manager package maps raw inputs (keyboard, mouse, gamepad) to named actions and reads their state each frame. It works as both a global resource and a per-entity component, and supports pluggable input sources for custom backends.
Register InputManagerPlugin on the world. It depends on InputPlugin from @shell/dom (added automatically).
import { InputManagerPlugin, InputMapData, wasd } from '@shell/input-manager';
world.addPlugin(InputManagerPlugin);To enable a global input map (useful for single-player or UI-level input), pass a config:
world.addPlugin( InputManagerPlugin.config({ globalMap: new InputMapData() .bind('move', { type: 'dualAxis', source: wasd() }) .bind('jump', { type: 'button', source: { kind: 'key', code: 'Space' } }), }),);This binds inputMap and actionState as world resources and enables the run condition helpers.
Topics
Section titled “Topics”- Input Bindings — Button, axis, and dual-axis bindings plus presets
- Action State — Reading global and per-entity action state
- Run Conditions — Gating systems on action state
- Custom Sources — Implementing custom input backends
- Control Schemes — Typed, component-based input schemes