An emulated gamepad.

Constructors

Properties

buttons: {
    0: GamepadButton;
    1: GamepadButton;
    10: GamepadButton;
    11: GamepadButton;
    12: GamepadButton;
    13: GamepadButton;
    14: GamepadButton;
    15: GamepadButton;
    16: GamepadButton;
    17: GamepadButton;
    18: GamepadButton;
    19: GamepadButton;
    2: GamepadButton;
    20: GamepadButton;
    21: GamepadButton;
    22: GamepadButton;
    23: GamepadButton;
    24: GamepadButton;
    25: GamepadButton;
    26: GamepadButton;
    27: GamepadButton;
    28: GamepadButton;
    29: GamepadButton;
    3: GamepadButton;
    30: GamepadButton;
    31: GamepadButton;
    32: GamepadButton;
    33: GamepadButton;
    34: GamepadButton;
    35: GamepadButton;
    36: GamepadButton;
    37: GamepadButton;
    38: GamepadButton;
    39: GamepadButton;
    4: GamepadButton;
    40: GamepadButton;
    41: GamepadButton;
    42: GamepadButton;
    43: GamepadButton;
    44: GamepadButton;
    45: GamepadButton;
    46: GamepadButton;
    5: GamepadButton;
    6: GamepadButton;
    7: GamepadButton;
    8: GamepadButton;
    9: GamepadButton;
} = {}

Every game buttons of the emulated gamepad

is_last_input_gamepad: boolean

Whether the last button pressed comes from the keybord or the controller

stick_dead_zone: number

The stick dead zone

trigger_dead_zone: number

The trigger dead zone

gamepad_mapping: KeyMap[]

Controller gamepad buttons configuration

gamepad_stick_mapping: KeyMap[]

Controller gamepad sticks configuration

keyboard_mapping: KeyMap[]

Keyboard gamepad keys configuration

Methods

  • Releases the game button if it is held down then triggers the listeners.

    Parameters

    • game_button: AnyButton

      The game button to release

    • Optional event: KeyboardEvent

      The keyboard event if any

    Returns GamepadButton

  • Checks if a gamepad button is currently down.

    Parameters

    Returns boolean

    • Whether the gamepad button is held down
  • Checks if a gamepad button is currently up.

    Parameters

    Returns boolean

    • Whether the gamepad button is up
  • Press any multi-buttons involved if none the button itself.

    Parameters

    • game_button: AnyButton

      The game button getting pressed

    Returns void

  • Releases any multi-buttons involved and the button itself.

    Parameters

    • game_button: AnyButton

      The game button getting released

    Returns void

  • Registers internal listeners on the gamepad and the keyboard to trigger emulated game button.

    Parameters

    • game: Game

      Phaser game

    Returns void

  • Loads the gamepad and keyboard configuration.

    Parameters

    • data: GoldenSun

      Master game data object

    • Optional input_type: string = "default_inputs"

      Keyboard key mapping configuration name

    Returns void

  • Gets the GBA button(s) attached to the controller button.

    Parameters

    • button_code: number

      Controller button code.

    Returns AnyButton[]

    • GBA (custom) button(s)
  • Gets the GBA button(s) attached to the Phaser keyboard key.

    Parameters

    • key_code: number

      Phaser keyboard key code.

    Returns AnyButton[]

    • GBA (custom) button(s)