WebInputEventManager

Manages the capture and conversion of DOM input events (mouse and keyboard) for a canvas element, converting them to Zernikalos events and enqueuing them in an event queue for synchronous processing during the game loop.

This class handles:

  • Registering event listeners on the canvas

  • Converting DOM events to Zernikalos events using adapters

  • Enqueuing events in the event queue instead of processing them immediately

  • Cleaning up event listeners on disposal

Constructors

Link copied to clipboard
constructor(canvas: HTMLCanvasElement, eventQueue: ZEventQueue?)

Functions

Link copied to clipboard
fun dispose()

Disposes the manager and removes all event listeners. Call this when the canvas is no longer needed.

Link copied to clipboard

Gets the current event queue.

Link copied to clipboard

Gets the current event handler (for compatibility with ZUserInputEventHandler interface). Returns the event queue since it implements ZUserInputEventHandler.

Link copied to clipboard
fun setEventQueue(newQueue: ZEventQueue?)

Updates the event queue that receives converted events.

Link copied to clipboard

Updates the event handler (for compatibility with ZUserInputEventHandler interface). If the handler is a ZEventQueue, it will be used directly. Otherwise, it will be ignored.