PokéRogue
    Preparing search index...

    Represents a single button on a Gamepad controller. Each Button has a value between 0 and 1 (supporting analog pressure for triggers) and a pressed boolean state. When the value exceeds the configurable threshold, the button emits BUTTON_DOWN and GAMEPAD_BUTTON_DOWN events. Button objects are created automatically by the Gamepad as they are needed.

    Index
    • Parameters

      • pad: Gamepad

        A reference to the Gamepad that this Button belongs to.

      • index: number

        The index of this Button.

      • OptionalisPressed: boolean

        Whether or not the button is already being pressed at creation time. This prevents the Button from emitting spurious 'down' events at first update. Default false.

      Returns Button

    events: EventEmitter

    An event emitter to use to emit the button events.

    index: number

    The index of this Button.

    pad: Gamepad

    A reference to the Gamepad that this Button belongs to.

    pressed: boolean

    Is the Button being pressed down or not?

    threshold: number

    The minimum value the button must reach before it is considered as being pressed. The value is between 0 and 1. The default of 1 requires the button to be fully pressed. For analog buttons such as triggers, you can lower this threshold to detect partial presses.

    value: number

    The current value of the button, between 0 (fully released) and 1 (fully pressed). For analog buttons like triggers, this reflects the pressure applied.

    • Destroys this Button instance and releases external references it holds.

      Returns void