Gleam - v1.0.2
    Preparing search index...

    Class Pointer

    Pointer (mouse / pen / touch) state. Wired into Game automatically. The preferred way to consume input is to subscribe to the EventSystem "inputPointer" event — it fires on every move and button transition, with this Pointer instance as the payload. If you need the latest state on a frame boundary instead, poll game.pointer.posScaled and game.pointer.pressed[POINTER_KEYS.LEFT] from update.

    Suppresses the browser context menu on right-click globally.

    Index

    Constructors

    Properties

    hasMoved: boolean = false

    Dirty bit set to true on every move and never cleared by the engine — flip it back to false after reading to detect "moved since last check".

    lastEvent: PointerEvent | null = null

    Last raw PointerEvent received. null until any pointer event fires. Use for properties not surfaced as Vec2/booleans (pressure, pointerType, etc.).

    posReal: Vec2 = ...

    Viewport-space coordinates (event.clientX/Y — CSS pixels relative to the page).

    posRealLast: Vec2 = ...

    Previous tick's posReal. Subtract for a per-frame delta.

    posScaled: Vec2 = ...

    Canvas-space coordinates, mapped from the bounding rect into the main canvas's pixel buffer and clamped to its size. This is the position to use for in-game logic.

    posScaledLast: Vec2 = ...

    Previous tick's posScaled.

    pressed: boolean[] = []

    Per-button pressed state. Index with POINTER_KEYS (e.g. pressed[POINTER_KEYS.LEFT]). Sparse — unindexed entries are undefined, not false.

    Methods

    • Clear all pressed-button state. Called automatically on window blur so held buttons don't stay "pressed" forever when focus is lost.

      Returns void