Engine API Reference - v2.23.0-beta.17
    Preparing search index...

    Class GamepadSourceAlpha

    Game pad input source class. Each read polls the connected gamepads and yields buttons deltas for the buttons listed in buttonCode, and leftStick and rightStick deltas as [x, y].

    Hierarchy (View Summary)

    Index
    _element: HTMLElement | null = null
    deltas: { buttons: InputDelta; leftStick: InputDelta; rightStick: InputDelta } = ...

    Type Declaration

    • buttons: InputDelta

      The button deltas, represented as an array of button states (0 or 1).

    • leftStick: InputDelta

      The left stick deltas, represented as an array of [x, y] coordinates.

    • rightStick: InputDelta

      The right stick deltas, represented as an array of [x, y] coordinates.

    buttonCode: {
        A: 0;
        B: 1;
        LB: 4;
        LEFT_STICK: 10;
        LT: 6;
        RB: 5;
        RIGHT_STICK: 11;
        RT: 7;
        SELECT: 8;
        START: 9;
        X: 2;
        Y: 3;
    } = BUTTON_CODES

    The button codes (based on Xbox controller layout).

    • Alpha

      Fires an event with the given name and arguments.

      Parameters

      • event: string

        The event name to fire.

      • ...args: any[]

        The arguments to pass to the event listeners.

      Returns void

    • Alpha

      Returns { buttons: number[]; leftStick: number[]; rightStick: number[] }

      • buttons: number[]

        The button deltas, represented as an array of button states (0 or 1).

      • leftStick: number[]

        The left stick deltas, represented as an array of [x, y] coordinates.

      • rightStick: number[]

        The right stick deltas, represented as an array of [x, y] coordinates.