public class TiledMapData extends java.lang.Object implements TiledParserListener
| Modifier and Type | Field and Description |
|---|---|
protected com.badlogic.gdx.files.FileHandle |
fileHandle |
protected java.util.List<Layer> |
layers |
protected java.util.Map<java.lang.String,TiledObjectGroup> |
objectGroups |
protected java.util.List<Tileset> |
tilesets |
| Constructor and Description |
|---|
TiledMapData(com.badlogic.gdx.files.FileHandle fileHandle) |
TiledMapData(TiledParser tiledParser,
com.badlogic.gdx.files.FileHandle fileHandle) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsAnimatedTiles()
Returns if this map contains animated tiles
|
boolean |
containsProperty(java.lang.String propertyName)
Returns if the map contains the specified property
|
void |
dispose()
Releases any resources used by this TiledMap including tilesets
|
void |
dispose(boolean disposeTilesets)
Releases any resources used by this TiledMap
|
java.util.List<Tile> |
getAnimatedTiles() |
com.badlogic.gdx.graphics.Color |
getBackgroundColor()
Returns the background
Color of the map |
com.badlogic.gdx.utils.Array<com.badlogic.gdx.assets.AssetDescriptor> |
getDependencies() |
com.badlogic.gdx.files.FileHandle |
getFileHandle()
Returns the
FileHandle for this data |
int |
getHeight()
Returns the height of the map in tiles
|
int |
getLayerIndex(java.lang.String name)
Returns the index of the
TileLayer or TiledObjectGroup
with the given name |
int |
getLayerIndexIgnoreCase(java.lang.String name)
Returns the index of the
TileLayer or TiledObjectGroup
with the given name ignoring upper/lowercase differences |
java.util.List<Layer> |
getLayers()
Returns the
Layers of this map |
TiledObjectGroup |
getObjectGroup(java.lang.String name)
Returns the
TiledObjectGroup with the given name |
java.util.Collection<TiledObjectGroup> |
getObjectGroups()
Returns all the
TiledObjectGroups in this map |
Orientation |
getOrientation()
Returns the
Orientation of this map |
int |
getPixelHeight()
Return the height of the map in pixels
|
int |
getPixelWidth()
Returns the width of the map in pixels
|
java.lang.String |
getProperty(java.lang.String propertyName)
Returns the value of a specified property
|
int |
getSideLength()
Returns the stagger side length of this map
|
StaggerAxis |
getStaggerAxis()
Returns the
StaggerAxis of this map |
StaggerIndex |
getStaggerIndex()
Returns the
StaggerIndex of this map |
Tile |
getTile(int tileId)
Returns the
Tile for the given tile ID |
Tile |
getTile(int x,
int y,
int layer)
Returns the
Tile at the given coordinate on a specific layer |
int |
getTileHeight()
Returns the height of tiles in pixels
|
TileLayer |
getTileLayer(int index)
Returns the
TileLayer at the given index |
TileLayer |
getTileLayer(java.lang.String name)
Returns the
TileLayer with the given name |
java.util.List<Tileset> |
getTilesets()
Returns the
Tilesets of this map |
int |
getTileWidth()
Returns the width of tiles in pixels
|
int |
getTotalLayers()
Returns the total amount of
Layer instances |
int |
getTotalObjectGroups()
Returns the total amount of
TiledObjectGroup instances |
int |
getWidth()
Returns the width of the map in tiles
|
void |
loadTilesetTextures() |
void |
loadTilesetTextures(com.badlogic.gdx.assets.AssetManager assetManager) |
void |
onBeginParsing(java.lang.String orientation,
java.lang.String staggerAxis,
java.lang.String staggerIndex,
com.badlogic.gdx.graphics.Color backgroundColor,
int width,
int height,
int tileWidth,
int tileHeight,
int sideLength) |
void |
onMapPropertyParsed(java.lang.String propertyName,
java.lang.String value) |
void |
onObjectGroupParsed(TiledObjectGroup parsedObjectGroup) |
void |
onTileLayerParsed(TileLayer parsedLayer) |
void |
onTilePropertiesParsed(Tile tile) |
void |
onTilesetParsed(Tileset parsedTileset) |
void |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value of a specified property
|
protected final com.badlogic.gdx.files.FileHandle fileHandle
protected final java.util.List<Tileset> tilesets
protected final java.util.List<Layer> layers
protected final java.util.Map<java.lang.String,TiledObjectGroup> objectGroups
public TiledMapData(com.badlogic.gdx.files.FileHandle fileHandle)
fileHandle - TiledExceptionpublic TiledMapData(TiledParser tiledParser, com.badlogic.gdx.files.FileHandle fileHandle)
tiledParser - fileHandle - TiledExceptionpublic com.badlogic.gdx.utils.Array<com.badlogic.gdx.assets.AssetDescriptor> getDependencies()
public void loadTilesetTextures()
public void loadTilesetTextures(com.badlogic.gdx.assets.AssetManager assetManager)
public void onBeginParsing(java.lang.String orientation,
java.lang.String staggerAxis,
java.lang.String staggerIndex,
com.badlogic.gdx.graphics.Color backgroundColor,
int width,
int height,
int tileWidth,
int tileHeight,
int sideLength)
onBeginParsing in interface TiledParserListenerpublic boolean containsProperty(java.lang.String propertyName)
propertyName - The property name to search forpublic java.lang.String getProperty(java.lang.String propertyName)
propertyName - The property name to search forpublic void setProperty(java.lang.String propertyName,
java.lang.String value)
propertyName - The property name to set the value forvalue - The value of the property to setpublic void onMapPropertyParsed(java.lang.String propertyName,
java.lang.String value)
onMapPropertyParsed in interface TiledParserListenerpublic void onTilePropertiesParsed(Tile tile)
onTilePropertiesParsed in interface TiledParserListenerpublic void onTilesetParsed(Tileset parsedTileset)
onTilesetParsed in interface TiledParserListenerpublic void onTileLayerParsed(TileLayer parsedLayer)
onTileLayerParsed in interface TiledParserListenerpublic void onObjectGroupParsed(TiledObjectGroup parsedObjectGroup)
onObjectGroupParsed in interface TiledParserListenerpublic TileLayer getTileLayer(java.lang.String name)
TileLayer with the given namename - The name to search forTileLayerpublic TileLayer getTileLayer(int index)
TileLayer at the given indexindex - The index of the layerpublic TiledObjectGroup getObjectGroup(java.lang.String name)
TiledObjectGroup with the given namename - The name to search forTiledObjectGrouppublic java.util.Collection<TiledObjectGroup> getObjectGroups()
TiledObjectGroups in this mapTiledObjectGroupspublic int getLayerIndex(java.lang.String name)
TileLayer or TiledObjectGroup
with the given namename - The name to search forTileLayer or
TiledObjectGrouppublic int getLayerIndexIgnoreCase(java.lang.String name)
TileLayer or TiledObjectGroup
with the given name ignoring upper/lowercase differencesname - The name to search forTileLayer or
TiledObjectGrouppublic Tile getTile(int tileId)
Tile for the given tile IDtileId - The tile ID to search forTile with the given IDpublic Tile getTile(int x, int y, int layer)
Tile at the given coordinate on a specific layerx - The x coordinate (in tiles)y - The y coordinate (in tiles)layer - The layer indexTilepublic Orientation getOrientation()
Orientation of this mappublic StaggerAxis getStaggerAxis()
StaggerAxis of this mappublic StaggerIndex getStaggerIndex()
StaggerIndex of this mappublic int getSideLength()
public int getWidth()
public int getHeight()
public int getTileWidth()
public int getTileHeight()
public int getPixelWidth()
public int getPixelHeight()
public java.util.List<Tileset> getTilesets()
Tilesets of this mappublic java.util.List<Tile> getAnimatedTiles()
public int getTotalObjectGroups()
TiledObjectGroup instancespublic int getTotalLayers()
Layer instancespublic com.badlogic.gdx.graphics.Color getBackgroundColor()
Color of the mappublic boolean containsAnimatedTiles()
public com.badlogic.gdx.files.FileHandle getFileHandle()
FileHandle for this datapublic void dispose()
public void dispose(boolean disposeTilesets)
disposeTilesets - True if tilesets should also be disposed