Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DeviceInputSystem

This class will take all inputs from Keyboard, Pointer, and any Gamepads and provide a polling system that all devices will use. This class assumes that there will only be one pointer device and one keyboard.

Hierarchy

  • DeviceInputSystem

Implements

Index

Properties

onDeviceDisconnectedSearch playground for onDeviceDisconnected

onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void

Callback to be triggered when a device is disconnected

Type declaration

    • (deviceType: DeviceType, deviceSlot: number): void
    • Parameters

      Returns void

onInputChangedSearch playground for onInputChanged

onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, previousState: Nullable<number>, currentState: Nullable<number>, eventData?: any) => void

Callback to be triggered when event driven input is updated

Type declaration

    • (deviceType: DeviceType, deviceSlot: number, inputIndex: number, previousState: Nullable<number>, currentState: Nullable<number>, eventData?: any): void
    • Parameters

      • deviceType: DeviceType
      • deviceSlot: number
      • inputIndex: number
      • previousState: Nullable<number>
      • currentState: Nullable<number>
      • Optional eventData: any

      Returns void

Accessors

onDeviceConnected

  • get onDeviceConnected(): (deviceType: DeviceType, deviceSlot: number) => void
  • set onDeviceConnected(callback: (deviceType: DeviceType, deviceSlot: number) => void): any
  • Returns onDeviceConnected callback property

    Returns (deviceType: DeviceType, deviceSlot: number) => void

    Callback with function to execute when a device is connected

      • (deviceType: DeviceType, deviceSlot: number): void
      • Parameters

        Returns void

  • Sets callback function when a device is connected and executes against all connected devices

    Parameters

    • callback: (deviceType: DeviceType, deviceSlot: number) => void

      Function to execute when a device is connected

        • (deviceType: DeviceType, deviceSlot: number): void
        • Parameters

          Returns void

    Returns any

    Callback with function to execute when a device is connected

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Dispose of all the eventlisteners

    Returns void

isDeviceAvailableSearch playground for isDeviceAvailable

  • isDeviceAvailable(deviceType: DeviceType): boolean
  • Check for a specific device in the DeviceInputSystem

    Parameters

    • deviceType: DeviceType

      Type of device to check for

    Returns boolean

    bool with status of device's existence

pollInputSearch playground for pollInput

  • pollInput(deviceType: DeviceType, deviceSlot: number, inputIndex: number): number
  • Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.

    Parameters

    • deviceType: DeviceType

      Enum specifiying device type

    • deviceSlot: number

      "Slot" or index that device is referenced in

    • inputIndex: number

      Id of input to be checked

    Returns number

    Current value of input

Static CreateSearch playground for Create

  • Creates a new DeviceInputSystem instance

    Parameters

    • engine: Engine

      Engine to pull input element from

    Returns DeviceInputSystem

    The new instance

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method