arcade2d
Interface

MouseSnapshot

input/mouse.types.ts:48

Per-tick snapshot of mouse state at the game tier — canvas-local pointer position and held button state, with no concept of a camera or world transform. Returned by Mouse.getState and by Game.getMouseState().

Game-tier code working in screen space (HUDs, menus, click-through detection on UI overlays) should read this directly. Game-world code that wants the cursor in world coordinates should reach for World.getMouseState, which extends this snapshot into a full MouseState with a position field projected through the active world's camera.

Returned objects are fresh on every call — the engine intentionally does not hand back a live reference, so a caller stashing the value for a frame won't see it change mid-update.

Properties

readonly #
buttons: MouseButtons

Held state of the three standard mouse buttons. See MouseButtons for the per-button semantics.

readonly #
screenPosition: Point

Cursor position in canvas-local pixels. (0, 0) is the canvas's top-left, regardless of where the canvas sits on the page.

ESC