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

    • options: {
          axis: VirtualAxis;
      } | {
          category?: string;
          deadZone?: number;
          invert?: boolean;
          name: string;
          sensitivity?: number;
          type: EnumValue<InputAxis, number>;
      }

      Options object for the function call.

    Returns VirtualAxis

    The axis or null if not, or already registered.

  • Registers the virtual button.

    Parameters

    • options: {
          button: VirtualButton;
      } | {
          buttonCodes: readonly EnumValue<ButtonCode, number>[];
          category?: string;
          modifiers?: EnumValue<ButtonModifier, number>;
          name: string;
          repeatable?: boolean;
      }

      Options object for the function call.

    Returns VirtualButton

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

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

    Parameters

    • options: {
          category?: string;
          name: string;
      } | {
          axis: VirtualAxis;
      }

      Options object for the function call.

    Returns boolean

    true if the axis was unregistered.

    Each category only support each name uniquely.

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

    Parameters

    • options: {
          category?: string;
          name: string;
      } | {
          button: VirtualButton;
      }

      Options object for the function call.

    Returns boolean

    true if the buttons was unregistered.

    Each category only support each name uniquely.

Events

onButtonBindingChanged: Event<[VirtualButton], void>

Triggered when the bindings changed for a currently registered button.