Constructors

Properties

events: EventEmitter

Methods

  • Binds a node to a specific key to simulate keyboard events on touch.

    Parameters

    • node: HTMLElement

      The DOM element to bind the key to.

    • key: string

      The key to simulate.

    Returns void

    This function binds touch events to a node to simulate 'keydown' and 'keyup' keyboard events. It adds the key to the keys map and tracks the keydown state. When a touch starts, it simulates a 'keydown' event and adds an 'active' class to the node. When the touch ends, it simulates a 'keyup' event, removes the keydown state, and removes the 'active' class from the node and the last touched element.

  • Simulates a keyboard event on the canvas.

    Parameters

    • eventType: string

      The type of the keyboard event ('keydown' or 'keyup').

    • key: string

      The key to simulate.

    Returns void

    This function checks if the key exists in the Button enum. If it does, it retrieves the corresponding button and emits the appropriate event ('input_down' or 'input_up') based on the event type.

  • Parameters

    • node: HTMLElement
    • key: string
    • id: string

    Returns void