libgdx API

com.badlogic.gdx.graphics.g2d.tiled
Class TileAtlas

java.lang.Object
  extended by com.badlogic.gdx.graphics.g2d.tiled.TileAtlas
All Implemented Interfaces:
Disposable
Direct Known Subclasses:
SimpleTileAtlas

public class TileAtlas
extends java.lang.Object
implements Disposable

Contains an atlas of tiles by tile id for use with TileMapRenderer

Author:
David Fraska

Field Summary
protected  IntMap<TextureRegion> regionsMap
           
protected  java.util.HashSet<Texture> textures
           
 
Constructor Summary
protected TileAtlas()
          Protected constructor to allow different implementations
  TileAtlas(TiledMap map, FileHandle inputDir)
          Creates a TileAtlas for use with TileMapRenderer.
 
Method Summary
 void dispose()
          Releases all resources associated with this TileAtlas instance.
 void flipRegions(boolean x, boolean y)
          Flips all regions in the atlas on the specified axis.
 TextureRegion getRegion(int id)
          Gets an TextureRegion for a tile id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regionsMap

protected IntMap<TextureRegion> regionsMap

textures

protected final java.util.HashSet<Texture> textures
Constructor Detail

TileAtlas

protected TileAtlas()
Protected constructor to allow different implementations


TileAtlas

public TileAtlas(TiledMap map,
                 FileHandle inputDir)
Creates a TileAtlas for use with TileMapRenderer. Run the map through TiledMapPacker to create the files required.

Parameters:
map - The tiled map
inputDir - The directory containing all the files created by TiledMapPacker
Method Detail

getRegion

public TextureRegion getRegion(int id)
Gets an TextureRegion for a tile id

Parameters:
id - tile id
Returns:
the TextureRegion

dispose

public void dispose()
Releases all resources associated with this TileAtlas instance. This releases all the textures backing all AtlasRegions, which should no longer be used after calling dispose.

Specified by:
dispose in interface Disposable

flipRegions

public void flipRegions(boolean x,
                        boolean y)
Flips all regions in the atlas on the specified axis.

Parameters:
x - - if true region is flipped on the x axis
y - - if true region is flipped on the y axis

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)