Options
All
  • Public
  • Public/Protected
  • All
Menu

This class allows to bind callbacks to gamepad buttons. For permanent bindings, set "persist" to true when adding controls. Permanent bindings are kept even if you call ControlManager.reset. Otherwise, set "persist" to false, then these controls will be disabled after ControlManager.reset is called.

Hierarchy

  • ControlManager

Index

Constructors

Properties

audio: Audio
current_set_key?: number

Key of the current binding set.

current_signal_bindings: SignalBinding[]

Current binding set, that will be reset upon demand.

disabled: boolean
game: Game
gamepad: Gamepad
loop_repeat_timer: Timer

Some timer

loop_start_timer: Timer

Some timer

signal_bindings: {}

Every currently listening signals (binding sets).

Type declaration

  • [key: number]: Phaser.SignalBinding[]

Accessors

  • get initialized(): number

Methods

  • apply_control_params(controls: Control[], params: any): void
  • check_bt_sequence_is_down(buttons: Button[]): boolean
  • Checks if a sequence of given buttons is down till the one before the last of the given list.

    Parameters

    • buttons: Button[]

      the sequence of buttons.

    Returns boolean

    returns whether the sequence of buttons till the one before the last is down.

  • detach_bindings(key: number): void
  • enable_controls(controls: Control[], persist?: boolean, call_once?: boolean): number
  • Add a listener/event for the controls passed.

    Parameters

    • controls: Control[]

      Controls to listen for.

    • Optional persist: boolean

      Whether the controls have to persist.

    • Optional call_once: boolean

      Whether the controls will be called once.

    Returns number

  • make_key(): number
  • Finds the next usable index of the persisting bindings. we could also simply use .length

    Returns number

    • A free usable index
  • reset(detach?: boolean): void
  • Stops the loop timers and removes the current listeners.

    Parameters

    • detach: boolean = true

      Whether to removes the current listeners

    Returns void

  • start_loop_timers(callback: Function, loop_time: number, sfx: string | (() => string)): void
  • Registers a new loop timer.

    Parameters

    • callback: Function

      Callback to call at each tick

    • loop_time: number

      Ticks length

    • sfx: string | (() => string)

      Sfx to play at each tick

    Returns void

  • stop_timers(): void

Generated using TypeDoc