Create a Pointer bound to an element (or window by default).
window
No-op stub when called server-side, just like createKeyboard.
const canvas = document.querySelector('canvas')!;const pointer = createPointer({ target: canvas });pointer.onDown(({ x, y }) => game.actions.spawn(x, y));pointer.onMove(({ x, y, isDown }) => { if (isDown) game.actions.drag(x, y); }); Copy
const canvas = document.querySelector('canvas')!;const pointer = createPointer({ target: canvas });pointer.onDown(({ x, y }) => game.actions.spawn(x, y));pointer.onMove(({ x, y, isDown }) => { if (isDown) game.actions.drag(x, y); });
Create a Pointer bound to an element (or
windowby default).No-op stub when called server-side, just like createKeyboard.