Gamalto

Fork me on GitHub

Object TileSet Overview

Gamalto. TileSet

new Gamalto.TileSet(bitmap, size)

Creates a set of tiles from a bitmap to render tile-based graphics.

Parameters
Name Type Description
bitmap Gamalto.Bitmap

Image holding the tiles data.

size Gamalto.Size

Size of a tile.

Extends

Members

firstIndex :number

Gets or sets the index of the first tile in this tileset.

length :number

inherited readonly

Number of items in the list.

Inherited From

offset :Gamalto.Vector2

Gets or sets the offset in pixels to be applied when drawing a tile from the tileset.

size :Gamalto.Size

readonly

Gets the size of a tile in the tileset.

tag :object

inherited

Utility property to exchange data between objects.

Inherited From

Methods

addSections(countopt, ropt) Gamalto.SpriteSheet

override

Adds a new set of tiles to the list using the specified parameters. The size is here implied and equals to the size specified in the constructor.

Parameters
Name Type Attributes Description
count number <optional>

Number of tile sections to compute. Defaults to the number of sections contained in the specified rectangle.

r Gamalto.IBox <optional>

Rectangle defining the bounds of the container. Defaults to the bitmap bounds.

Overrides
Returns
  • Current object for method chaining.

clone() object

inherited abstract

Clones the object. It will be shallow copy unless otherwise specfied.

Inherited From
Returns
  • New instance of the object. Defaults to null.

draw(renderer, x, y, index)

override

Draws a tile into a surface.

Parameters
Name Type Description
renderer Gamalto.BaseRenderer

Renderer of the surface where the tile must be drawn.

x number

Horizontal drawing position.

y number

Vertical drawing position.

index number

Zero-based index of the tile to be drawn.

Overrides

getSection(index) object

inherited

Gets the section at the specified index.

Parameters
Name Type Description
index number

Zero-based index of the section.

Inherited From
Returns
  • Requested section. The type depends on the implementation.

insertSection(at, section)

inherited

Inserts an existing section into the list.

Parameters
Name Type Description
at number

Zero-based index where the section must be inserted.

section object

Section to be added. The type depends on the implementation.

Inherited From

setMargin(x, y)

inherited

Sets the global margin around the sections in the container.

Parameters
Name Type Description
x number

Horizontal margin.

y number

Vertical margin.

Inherited From

setSpacing(x, y)

inherited

Sets the spacing around a section in the container.

Parameters
Name Type Description
x number

Horizontal spacing between sections.

y number

Vertical spacing between sections.

Inherited From

toString() string

inherited abstract

Converts the object into a string.

Inherited From
Returns
  • string

Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 20:13:31 GMT+0200 (CEST)