gameplate - v2.2.0
    Preparing search index...

    Function createPointer

    • Create a Pointer bound to an element (or window by default).

      No-op stub when called server-side, just like createKeyboard.

      Parameters

      • options: PointerOptions = {}

      Returns Pointer

      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); });