Class InputConfiguration

The InputConfiguration class enables developers to create virtual HID controls that map to physical devices. The abstraction makes it easy to dynamically change the behavior, or the button codes that trigger the input.

An InputConfigurationProfile can be assigned to the configuration, to provides a way to remap virtual buttons to other button codes after their creation. This allows developers to provide their users with a way to remap the stock button layout to other physical buttons. The profile can be trivially serialized as other types, and applied upon loading it.

Hierarchy

  • FrameworkObject
    • InputConfiguration

Constructors

Accessors

  • get repeatInterval(): number
  • Sets repeat interval for held virtual buttons. Buttons will be continously triggered in interval increments as long as they button is being held.

    Returns number

  • set repeatInterval(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Gets a previously registered virtual button with the specified name and category.

    Parameters

    • name: string

      Unique name used to access the virtual button.

    • Optionalcategory: string

      The category of the button, if undefined, the default category will be used.

    Returns VirtualAxis

    The axis or null if not registered.

  • Gets a previously registered virtual button with the specified name and category.

    Parameters

    • name: string

      Unique name used to access the virtual button.

    • Optionalcategory: string

      The category of the button, if undefined, the default category will be used.

    Returns VirtualButton

    true upon success.

  • Registers the virtual axis.

    Parameters

    Returns VirtualAxis

    The axis or null if not, or already registered.

  • Registers a new virtual axis.

    Parameters

    • name: string

      Unique name used to access the virtualAxis.

    • registrationScope: EnumValue<InputRegistrationScope, number>

      The scope of the registration. Used to batch unregister if the scope is removed.

    • type: EnumValue<InputAxis, number>

      Type of physical axis to map to.

    • OptionaldeadZone: number
    • Optionalsensitivity: number

      Higher sensitivity means the axis will more easily reach its maximum values.

    • Optionalinvert: boolean

      Should axis values be inverted.

    • Optionalcategory: string

      The category of the axis, if undefined, the default category will be used.

    Returns VirtualAxis

    The axis or null if not, or already registered.

    Each category only support each name uniquely.

  • Registers the virtual button.

    Parameters

    Returns VirtualButton

    The newly created button or null if failed, or if it was already registered.

  • Registers a new virtual button, or updates a previously registered button.

    Parameters

    • name: string

      Unique name used to access the virtual button. Must be unique in the category.

    • registrationScope: EnumValue<InputRegistrationScope, number>

      The scope of the registration. Used to batch unregister if the scope is removed.

    • buttonCodes: readonly EnumValue<ButtonCode, number>[]

      Physical buttons the virtual button is triggered by.

    • Optionalmodifiers: EnumValue<ButtonModifier, number>

      Modifiers required to be pressed with the physical button to trigger the virtual button.

    • Optionalrepeatable: boolean

      If true, the virtual button events will be sent continually while the physical button is being held.

    • Optionalcategory: string

      The category of the button, if undefined, the default category will be used.

    Returns VirtualButton

    The newly created button or null if failed, or if it was already registered.

    Each category only supports each name uniquely.

  • Unregisters a virtual virtualAxis with the specified name. You will no longer be able to retrieve valid values for that virtualAxis.

    Parameters

    • name: string

      Unique name used to access the virtual axis.

    • Optionalcategory: string

      The category of the axis, if undefined, the default category will be used.

    Returns boolean

    true if the axis was unregistered.

    Each category only support each name uniquely.

  • Unregisters a virtual virtualAxis with the specified name. You will no longer be able to retrieve valid values for that virtualAxis.

    Parameters

    Returns boolean

    true if the axis was unregistered.

  • Unregisters all virtual buttons with the matching name and category for all button codes. Events will no longer be generated for that button.

    Parameters

    • name: string

      Unique name used to access the virtual button.

    • Optionalcategory: string

      The category of the button, if undefined, the default category will be used.

    Returns boolean

    true if the buttons was unregistered.

    Each category only support each name uniquely.

  • Unregisters the virtual button. Events will no longer be generated for that button.

    Parameters

    Returns boolean

    true if the buttons was unregistered.

Events

onButtonBindingChanged: Event<[button: VirtualButton], void>

Triggered when the bindings changed for a currently registered button.