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

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

      Options object for the function call.

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

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