Options
All
  • Public
  • Public/Protected
  • All
Menu

An emulated gamepad.

Hierarchy

  • Gamepad

Index

Constructors

Properties

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

  • Press the game button if it is up then triggers the listeners.

    Parameters

    • game_button: AnyButton

      The game button to press

    • Optional event: KeyboardEvent

      The keyboard event if any

    Returns GamepadButton

  • 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
  • on_gamepad_down(game_button: AnyButton): void
  • 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

  • register_handle_events(game: Game): void
  • Registers internal listeners on the gamepad and the keyboard to trigger emulated game button.

    Parameters

    • game: Game

      Phaser game

    Returns void

  • initialize(data: GoldenSun, input_type?: string): void
  • Loads the gamepad and keyboard configuration.

    Parameters

    • data: GoldenSun

      Master game data object

    • input_type: string = "default_inputs"

    Returns void

  • transcode_gamepad_button(button_code: number): AnyButton[]
  • Gets the GBA button(s) attached to the controller button.

    Parameters

    • button_code: number

      Controller button code.

    Returns AnyButton[]

    • GBA (custom) button(s)
  • transcode_keyboard_key(key_code: number): AnyButton[]
  • 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)

Generated using TypeDoc