public class TiledMapData extends java.lang.Object implements TiledParserListener
Modifier and Type | Field and Description |
---|---|
protected FileHandle |
fileHandle |
protected org.mini2Dx.gdx.utils.Array<Layer> |
layers |
protected org.mini2Dx.gdx.utils.ObjectMap<java.lang.String,TiledObjectGroup> |
objectGroups |
protected org.mini2Dx.gdx.utils.IntSet |
tilesetGids |
protected org.mini2Dx.gdx.utils.Array<Tileset> |
tilesets |
Constructor and Description |
---|
TiledMapData(FileHandle fileHandle) |
TiledMapData(TiledParser tiledParser,
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
|
org.mini2Dx.gdx.utils.Array<Tile> |
getAnimatedTiles() |
Color |
getBackgroundColor()
Returns the background
Color of the map |
org.mini2Dx.gdx.utils.Array<AssetDescriptor> |
getDependencies() |
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 |
org.mini2Dx.gdx.utils.Array<Layer> |
getLayers()
Returns the
Layer s of this map |
TiledObjectGroup |
getObjectGroup(java.lang.String name)
Returns the
TiledObjectGroup with the given name |
java.lang.Iterable<TiledObjectGroup> |
getObjectGroups()
Returns all the
TiledObjectGroup s 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 |
org.mini2Dx.gdx.utils.Array<Tileset> |
getTilesets()
Returns the
Tileset s 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(AssetManager assetManager) |
void |
loadTilesetTextures(AssetManager assetManager,
boolean loadObjectTemplateTilesets) |
void |
loadTilesetTextures(boolean loadObjectTemplateTilesets) |
void |
loadTilesetTextures(TextureAtlas textureAtlas) |
void |
loadTilesetTextures(TextureAtlas textureAtlas,
boolean loadObjectTemplateTilesets) |
void |
onBeginParsing(java.lang.String orientation,
java.lang.String staggerAxis,
java.lang.String staggerIndex,
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 FileHandle fileHandle
protected final org.mini2Dx.gdx.utils.Array<Tileset> tilesets
protected final org.mini2Dx.gdx.utils.IntSet tilesetGids
protected final org.mini2Dx.gdx.utils.Array<Layer> layers
protected final org.mini2Dx.gdx.utils.ObjectMap<java.lang.String,TiledObjectGroup> objectGroups
public TiledMapData(FileHandle fileHandle)
fileHandle
- TiledException
public TiledMapData(TiledParser tiledParser, FileHandle fileHandle)
tiledParser
- fileHandle
- TiledException
public org.mini2Dx.gdx.utils.Array<AssetDescriptor> getDependencies()
public void loadTilesetTextures()
public void loadTilesetTextures(AssetManager assetManager)
public void loadTilesetTextures(TextureAtlas textureAtlas)
public void loadTilesetTextures(boolean loadObjectTemplateTilesets)
public void loadTilesetTextures(AssetManager assetManager, boolean loadObjectTemplateTilesets)
public void loadTilesetTextures(TextureAtlas textureAtlas, boolean loadObjectTemplateTilesets)
public void onBeginParsing(java.lang.String orientation, java.lang.String staggerAxis, java.lang.String staggerIndex, Color backgroundColor, int width, int height, int tileWidth, int tileHeight, int sideLength)
onBeginParsing
in interface TiledParserListener
public 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 TiledParserListener
public void onTilePropertiesParsed(Tile tile)
onTilePropertiesParsed
in interface TiledParserListener
public void onTilesetParsed(Tileset parsedTileset)
onTilesetParsed
in interface TiledParserListener
public void onTileLayerParsed(TileLayer parsedLayer)
onTileLayerParsed
in interface TiledParserListener
public void onObjectGroupParsed(TiledObjectGroup parsedObjectGroup)
onObjectGroupParsed
in interface TiledParserListener
public void onGroupLayerParsed(GroupLayer parsedLayer)
onGroupLayerParsed
in interface TiledParserListener
public void onObjectTemplateParsed(TiledObjectTemplate parsedObjectTemplate)
onObjectTemplateParsed
in interface TiledParserListener
public TileLayer getTileLayer(java.lang.String name)
TileLayer
with the given namename
- The name to search forTileLayer
public 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 forTiledObjectGroup
public 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()
TiledObjectGroup
s in this mapTiledObjectGroup
spublic int getLayerIndex(java.lang.String name)
TileLayer
or TiledObjectGroup
with the given namename
- The name to search forTileLayer
or
TiledObjectGroup
public int getLayerIndexIgnoreCase(java.lang.String name)
TileLayer
or TiledObjectGroup
with the given name ignoring upper/lowercase differencesname
- The name to search forTileLayer
or
TiledObjectGroup
public 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 indexTile
public 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 org.mini2Dx.gdx.utils.Array<Tileset> getTilesets()
Tileset
s of this mappublic org.mini2Dx.gdx.utils.Array<Layer> getLayers()
Layer
s of this mappublic org.mini2Dx.gdx.utils.Array<Tile> getAnimatedTiles()
public int getTotalObjectGroups()
TiledObjectGroup
instancespublic int getTotalLayers()
Layer
instancespublic 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 FileHandle getFileHandle()
FileHandle
for this datapublic void dispose()
public void dispose(boolean disposeTilesets)
disposeTilesets
- True if tilesets should also be disposed