Fork me on GitHub
View source

package haxepunk.graphics.atlas

class TileAtlas


extends Atlas

Static functions

View source

static loadFromAtlasRegion (region : AtlasRegion, tileWidth : Int, tileHeight : Int, tileMarginWidth : Int = 0, tileMarginHeight : Int = 0) : TileAtlas

Loads a TileAtlas from a region in another atlas.

 *  @param region				An AtlasRegion object to pull tiles from
 *  @param tileWidth			Width of the tiles
 *  @param tileHeight			Height of the tiles
 *  @param tileMarginWidth		Horizontal margin of the tiles
 *  @param tileMarginHeight		Vertical margin of the tiles
 *  @return A TileAtlas with all packed images defined as regions ordered like a normal tileset.
View source

static loadFromTextureAtlas (textureAtlas : TextureAtlas, regions : Array<String>) : TileAtlas

Loads a TileAtlas from a named TextureAtlas


Parameters:
textureAtlas   

A TextureAtlas object to pull frames from

regions   

A list of atlas region names in the order they should be in TileAtlas


Returns:

A TileAtlas with all packed images defined as regions ordered by sprite names supplied

Constructor

View source

new (source : AtlasDataType, tileWidth : Int, tileHeight : Int, tileMarginWidth : Int = 0, tileMarginHeight : Int = 0) : Void

Constructor.


Parameters:
source   

Source texture.

tileWidth   

Width of the tiles.

tileHeight   

Height of the tiles.

tileMarginWidth   

Horizontal margin of the tiles.

tileMarginHeight   

Vertical margin of the tiles.

Variables

read only tileCount : Int

The number of tiles.

read only tileHeight : Int

The height of the tiles.

read only tileMarginHeight : Int

The vertical margin of the tiles.

read only tileMarginWidth : Int

The horizontal margin of the tiles.

read only tileWidth : Int

The width of the tiles.

Functions

View source

getRegion (index : Int) : AtlasRegion

Gets an atlas region based on an identifier


Parameters:
index   

The tile index of the region to retrieve


Returns:

The atlas region object.

View source

prepare (tileWidth : Int, tileHeight : Int, tileMarginWidth : Int = 0, tileMarginHeight : Int = 0, tileOffsetX : Int = 0, tileOffsetY : Int = 0) : Void

Prepares the atlas for drawing.


Parameters:
tileWidth   

With of the tiles.

tileHeight   

Height of the tiles.

tileMarginWidth   

Tile horizontal margin.

tileMarginHeight   

Tile vertical margin.