Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implemented by

Index

Methods

addListener

Optional dispose

  • dispose(): void

emit

  • Calls each of the listeners registered for a given event.

    Type parameters

    Parameters

    Returns boolean

eventNames

  • Return an array listing the events for which the emitter has registered listeners.

    Returns keyof GridRendererEventMap[]

listenerCount

  • Return the number of listeners listening to a given event.

    Parameters

    Returns number

listeners

  • Return the listeners registered for a given event.

    Type parameters

    Parameters

    • event: T

    Returns ((...args: ArgumentMap<GridRendererEventMap>[T]) => void)[]

off

on

once

pixelCoordsToTileCoords

  • pixelCoordsToTileCoords(x: number, y: number, gridWidth: number, gridHeight: number): false | [x: number, y: number]
  • Converts coordinates in "pixel space" to coordinates in "tile space". In essence, if you pass in an (x, y) position on the canvas, this returns the corresponding (x, y) position on the grid.

    Parameters

    • x: number

      The x position, in pixels, to get the corresponding grid position for

    • y: number

      The y position, in pixels, to get the corresponding grid position for

    • gridWidth: number

      The width of the grid, in grid tiles

    • gridHeight: number

      The height of the grid, in grid tiles

    Returns false | [x: number, y: number]

removeAllListeners

  • Remove all listeners, or those of the specified event.

    Parameters

    Returns IGridRenderer

removeListener

setSize

  • setSize(newWidth: number, newHeight: number): void
  • Update the grid size width and height.

    Parameters

    • newWidth: number
    • newHeight: number

    Returns void

update

  • update(grid: IGrid): void
  • Update, then draw the current state of the app to the canvas element.

    Parameters

    • grid: IGrid

      The grid to be rendered

    Returns void

Generated using TypeDoc