Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Tileset

Container for a set of tiles read from an allhtds file.

Hierarchy

  • Tileset

Index

Constructors

constructor

  • Creates a new tileset with the given tiles.

    Parameters

    • tiles: Tile[]

      The tiles in this set.

    • disk: number

      The disk number.

    Returns Tileset

Methods

getDisk

  • getDisk(): number

getNumTiles

  • getNumTiles(): number
  • Returns the number of tiles in this set.

    Returns number

    The number of tiles.

getTile

  • getTile(index: number): Tile
  • Returns the tile with the given index.

    Parameters

    • index: number

      The index of the tile image to return.

    Returns Tile

    The tile image.

getTiles

  • getTiles(): Tile[]

toCanvas

  • toCanvas(): HTMLCanvasElement
  • Creates and returns a new canvas containing the tileset image. 16 tilesets per row.

    Returns HTMLCanvasElement

    The created canvas.

toDataUrl

  • toDataUrl(type?: undefined | string, ...args: any[]): string
  • Creates and returns a tileset image data URL. 16 tiles per row.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns string

    The created data URL.

toImage

  • toImage(type?: undefined | string, ...args: any[]): HTMLImageElement
  • Creates and returns a HTML image of the tileset. 16 tiles per row.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns HTMLImageElement

    The created HTML image.

Generated using TypeDoc