Class VirtualButton

The VirtualButton class implements an abstract HID button. The button can be mapped to multiple ButtonCode values at the same time to handle multiple inputs.

Hierarchy

  • FrameworkObject
    • VirtualButton

Constructors

  • Creates a new virtual button registered with to multiple ButtonCode.

    Parameters

    • name: string

      Unique name used to access the virtual button.

    • 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.

    • OptionalisInternalConstructor: boolean

    Returns VirtualButton

    The newly created button.

    The button must registered with an InputConfiguration to become active and start emitting events.

    Each category only support each name uniquely per ButtonCode.

  • Creates a new virtual button registered with a single ButtonCode.

    Parameters

    • name: string

      Unique name used to access the virtual button.

    • buttonCode: EnumValue<ButtonCode, number>

      Physical button 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.

    The button must registered with an InputConfiguration to become active and start emitting events.

    Each category only support each name uniquely per ButtonCode.

Accessors

  • get category(): string
  • Gets the category of the button.

    Returns string

  • get id(): UUID
  • Gets the ID of the button.

    Returns UUID

  • get isProfileOverriden(): boolean
  • Determines if the button is currently overriden by a profile.

    Returns boolean

  • get isRepeatable(): boolean
  • Determines if the button is repeatable.

    Returns boolean

  • get name(): string
  • Gets the name of the button.

    Returns string

Methods

  • Determines if the virtual button just getting pressed. This state is only active for one frame.

    Parameters

    • OptionaldeviceIndex: number

      Optional device index in case multiple input devices are available.

    Returns boolean

  • Determines if the virtual button is being held. This state is active as long as the button is being held down, possibly for multiple frames.

    Parameters

    • OptionaldeviceIndex: number

      Optional device index in case multiple input devices are available.

    Returns boolean

  • Determines if the virtual button just getting released. This state is only active for one frame.

    Parameters

    • OptionaldeviceIndex: number

      Optional device index in case multiple input devices are available.

    Returns boolean