public class TsxTilesetSource extends TilesetSource
TilesetSource
loaded from a TSX file. Allows for sharing data
across multiple TiledMap
instances.Constructor and Description |
---|
TsxTilesetSource(com.badlogic.gdx.files.FileHandle tmxDirectory,
java.lang.String tsxPath) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsProperty(java.lang.String propertyName)
Returns if the tileset contains the specified property
|
void |
dispose() |
void |
drawTile(Graphics g,
int tileId,
int firstGid,
int renderX,
int renderY)
Draws a tile to the
Graphics context |
void |
drawTileset(Graphics g,
int renderX,
int renderY)
Draws the whole tileset to the
Graphics context |
int |
getHeight()
Returns the height of this tileset in pixels
|
int |
getHeightInTiles()
Returns the height of this source in tiles
|
int |
getMargin()
Returns the margin at the borders of the tileset
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns the properties
Map of this Tileset |
java.lang.String |
getProperty(java.lang.String propertyName)
Returns the value of a specified property
|
int |
getSpacing()
Returns the internal spacing between each tile
|
Tile |
getTile(int tileId,
int firstGid)
Returns the
Tile for a given tile id |
int |
getTileHeight()
Returns the height of each tile in pixels
|
int |
getTileWidth()
Returns the width of each tile in pixels
|
java.lang.String |
getTsxPath() |
int |
getWidth()
Returns the width of this tileset in pixels
|
int |
getWidthInTiles()
Returns the width of this source in tiles
|
boolean |
isTextureLoaded()
Returns if the tileset texture image is loaded
|
void |
loadTexture(com.badlogic.gdx.files.FileHandle tmxDirectory)
Loads the tileset's texture image
|
void |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value of a specified property
|
contains, getTileId, getTileX, getTileY
public TsxTilesetSource(com.badlogic.gdx.files.FileHandle tmxDirectory, java.lang.String tsxPath)
public void loadTexture(com.badlogic.gdx.files.FileHandle tmxDirectory)
TilesetSource
loadTexture
in class TilesetSource
tmxDirectory
- The directory of the TMX filepublic boolean isTextureLoaded()
TilesetSource
isTextureLoaded
in class TilesetSource
public int getWidthInTiles()
TilesetSource
getWidthInTiles
in class TilesetSource
public int getHeightInTiles()
TilesetSource
getHeightInTiles
in class TilesetSource
public void drawTile(Graphics g, int tileId, int firstGid, int renderX, int renderY)
TilesetSource
Graphics
contextdrawTile
in class TilesetSource
g
- The Graphics
context available for renderingtileId
- The tile id to renderfirstGid
- The first gid of the parent tilesetrenderX
- The X coordinate to render atrenderY
- The Y coordinate to render atpublic void drawTileset(Graphics g, int renderX, int renderY)
TilesetSource
Graphics
contextdrawTileset
in class TilesetSource
g
- The Graphics
context available for renderingrenderX
- The X coordinate to render atrenderY
- The Y coordinate to render atpublic int getWidth()
TilesetSource
getWidth
in class TilesetSource
public int getHeight()
TilesetSource
getHeight
in class TilesetSource
public int getTileWidth()
TilesetSource
getTileWidth
in class TilesetSource
public int getTileHeight()
TilesetSource
getTileHeight
in class TilesetSource
public int getSpacing()
TilesetSource
getSpacing
in class TilesetSource
public int getMargin()
TilesetSource
getMargin
in class TilesetSource
public Tile getTile(int tileId, int firstGid)
TilesetSource
Tile
for a given tile idgetTile
in class TilesetSource
tileId
- The tile id to look upfirstGid
- The first gid for the tilesetTile
public boolean containsProperty(java.lang.String propertyName)
TilesetSource
containsProperty
in class TilesetSource
propertyName
- The property name to search forpublic java.lang.String getProperty(java.lang.String propertyName)
TilesetSource
getProperty
in class TilesetSource
propertyName
- The property name to search forpublic void setProperty(java.lang.String propertyName, java.lang.String value)
TilesetSource
setProperty
in class TilesetSource
propertyName
- The property name to set the value forvalue
- The value of the property to setpublic java.util.Map<java.lang.String,java.lang.String> getProperties()
TilesetSource
Map
of this Tileset
getProperties
in class TilesetSource
public java.lang.String getTsxPath()
public void dispose()