Options
All
  • Public
  • Public/Protected
  • All
Menu

Excalibur leverages the HTML5 Gamepad API where it is supported to provide controller support for your games.

Hierarchy

Index

Constructors

Properties

enabled: boolean = false

Whether or not to poll for Gamepad input (default: false)

eventDispatcher: EventDispatcher<any>

Direct access to the game object event dispatcher.

supported: boolean = !!(<any>navigator).getGamepads

Whether or not Gamepad API is supported

MinAxisMoveThreshold: number = 0.05

The minimum value an axis has to move before considering it a change

Methods

  • Safely retrieves a Gamepad at a specific index and creates one if it doesn't yet exist

    Parameters

    • index: number

    Returns Gamepad

  • count(): number
  • emit(eventName: string, eventObject: any): void
  • Emits a new event

    Parameters

    • eventName: string

      Name of the event to emit

    • eventObject: any

      Data associated with this event

    Returns void

  • Returns a list of all valid gamepads that meet the minimum configuration requirement.

    Returns Gamepad[]

  • init(): void
  • off(eventName: string, handler?: (event: Events.GameEvent<any, any>) => void): void
  • Alias for removeEventListener. If only the eventName is specified it will remove all handlers registered for that specific event. If the eventName and the handler instance are specified only that handler will be removed.

    Parameters

    Returns void

  • once(eventName: string, handler: (event: any) => void): void
  • Once listens to an event one time, then unsubscribes from that event

    Parameters

    • eventName: string

      The name of the event to subscribe to once

    • handler: (event: any) => void

      The handler of the event that will be auto unsubscribed

        • (event: any): void
        • Parameters

          • event: any

          Returns void

    Returns void

  • Sets the minimum gamepad configuration, for example {axis: 4, buttons: 4} means this game requires at minimum 4 axis inputs and 4 buttons, this is not restrictive all other controllers with more axis or buttons are valid as well. If no minimum configuration is set all pads are valid.

    Parameters

    Returns void

  • update(): void