ecspresso
    Preparing search index...

    Interface InputState<A>

    interface InputState<A extends string = string> {
        actions: ActionState<A>;
        gamepads: readonly GamepadState[];
        keyboard: KeyboardState;
        pointer: PointerState;
        definePlayer(id: string, map: ActionMap<A>): void;
        getActionMap(): Readonly<ActionMap<A>>;
        player(id: string): PlayerInput<A> | undefined;
        playerIds(): readonly string[];
        removePlayer(id: string): boolean;
        setActionMap(actions: ActionMap<A>): void;
    }

    Type Parameters

    • A extends string = string
    Index

    Properties

    actions: ActionState<A>

    Unified action state — fires when any bound input (keyboard, pointer, any pad) is active. Intended for menu/shared input.

    gamepads: readonly GamepadState[]

    Always length 4 (standard web gamepad slot count). Disconnected slots return connected: false.

    keyboard: KeyboardState
    pointer: PointerState

    Methods

    • Register or replace a player's action map. Per-player states are isolated from the unified actions.

      Parameters

      Returns void

    • Returns true if the player existed and was removed.

      Parameters

      • id: string

      Returns boolean