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

onDeviceConnected

Find examples in Playground
onDeviceConnected: function

Callback to be triggered when a device is connected

Type declaration

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

      Returns void

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

Methods

dispose

Find examples in Playground
  • dispose(): void

pollInput

Find examples in Playground
  • pollInput(deviceType: DeviceType, deviceSlot: number, inputIndex: number): Nullable<number>
  • Checks for current device input value, given an id and input index

    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 Nullable<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