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

onDeviceDisconnected

Find examples in Playground
onDeviceDisconnected: function

Callback to be triggered when a device is disconnected

Type declaration

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

      Returns void

onInputChanged

Find examples in Playground
onInputChanged: function

Callback to be triggered when event driven input is updated

Type declaration

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

      Returns void

Accessors

onDeviceConnected

Find examples in Playground
  • get onDeviceConnected(): function
  • set onDeviceConnected(callback: function): any
  • Returns onDeviceConnected callback property

    Returns function

    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: function

      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

dispose

Find examples in Playground
  • dispose(): void

pollInput

Find examples in Playground
  • 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 Create

Find examples in Playground
  • Creates a new DeviceInputSystem instance

    Parameters

    • engine: Engine

      Engine to pull input element from

    Returns DeviceInputSystem

    The new instance

Generated using TypeDoc