public class TiledMapData extends java.lang.Object implements TiledParserListener
| Modifier and Type | Field and Description |
|---|---|
protected com.badlogic.gdx.files.FileHandle |
fileHandle |
protected com.badlogic.gdx.utils.Array<Layer> |
layers |
protected com.badlogic.gdx.utils.ObjectMap<java.lang.String,TiledObjectGroup> |
objectGroups |
protected com.badlogic.gdx.utils.IntSet |
tilesetGids |
protected com.badlogic.gdx.utils.Array<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
|
com.badlogic.gdx.utils.Array<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 |
GroupLayer |
getGroupLayer(int index)
Returns the
GroupLayer at the given index |
GroupLayer |
getGroupLayer(java.lang.String name)
Returns the
GroupLayer with the given name |
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 |
com.badlogic.gdx.utils.Array<Layer> |
getLayers()
Returns the
Layers of this map |
TiledObjectGroup |
getObjectGroup(java.lang.String name)
Returns the
TiledObjectGroup with the given name |
java.lang.Iterable<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 |
com.badlogic.gdx.utils.Array<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
|
boolean |
isTilesetTexturesLoaded()
Returns if the
Tileset images have been loaded |
boolean |
isTilesetTexturesLoaded(boolean ignoreObjectTemplateTilesets)
Returns if the
Tileset images have been loaded |
void |
loadTilesetTextures() |
void |
loadTilesetTextures(com.badlogic.gdx.assets.AssetManager assetManager) |
void |
loadTilesetTextures(com.badlogic.gdx.assets.AssetManager assetManager,
boolean loadObjectTemplateTilesets) |
void |
loadTilesetTextures(boolean loadObjectTemplateTilesets) |
void |
loadTilesetTextures(com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas) |
void |
loadTilesetTextures(com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas,
boolean loadObjectTemplateTilesets) |
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 |
onGroupLayerParsed(GroupLayer parsedLayer) |
void |
onMapPropertyParsed(java.lang.String propertyName,
java.lang.String value) |
void |
onObjectGroupParsed(TiledObjectGroup parsedObjectGroup) |
void |
onObjectTemplateParsed(TiledObjectTemplate parsedObjectTemplate) |
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 com.badlogic.gdx.utils.Array<Tileset> tilesets
protected final com.badlogic.gdx.utils.IntSet tilesetGids
protected final com.badlogic.gdx.utils.Array<Layer> layers
protected final com.badlogic.gdx.utils.ObjectMap<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 loadTilesetTextures(com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas)
public void loadTilesetTextures(boolean loadObjectTemplateTilesets)
public void loadTilesetTextures(com.badlogic.gdx.assets.AssetManager assetManager,
boolean loadObjectTemplateTilesets)
public void loadTilesetTextures(com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas,
boolean loadObjectTemplateTilesets)
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 void onGroupLayerParsed(GroupLayer parsedLayer)
onGroupLayerParsed in interface TiledParserListenerpublic void onObjectTemplateParsed(TiledObjectTemplate parsedObjectTemplate)
onObjectTemplateParsed 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 GroupLayer getGroupLayer(java.lang.String name)
GroupLayer with the given namename - The name of the layerpublic GroupLayer getGroupLayer(int index)
GroupLayer at the given indexindex - The index of the layerpublic java.lang.Iterable<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 com.badlogic.gdx.utils.Array<Tileset> getTilesets()
Tilesets of this mappublic com.badlogic.gdx.utils.Array<Layer> getLayers()
Layers of this mappublic com.badlogic.gdx.utils.Array<Tile> getAnimatedTiles()
public int getTotalObjectGroups()
TiledObjectGroup instancespublic int getTotalLayers()
Layer instancespublic com.badlogic.gdx.graphics.Color getBackgroundColor()
Color of the mappublic boolean containsAnimatedTiles()
public boolean isTilesetTexturesLoaded()
Tileset images have been loadedpublic boolean isTilesetTexturesLoaded(boolean ignoreObjectTemplateTilesets)
Tileset images have been loadedignoreObjectTemplateTilesets - True if tilesets referenced by object templates should be ignoredpublic 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