public class Tileset
extends java.lang.Object
implements com.badlogic.gdx.utils.Disposable
TiledMap| Constructor and Description |
|---|
Tileset(int firstGid,
TilesetSource tilesetSource) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int tileId)
Returns true if this tileset contains the tile with the given id
|
boolean |
containsProperty(java.lang.String propertyName)
Returns if the tileset contains the specified property
|
void |
dispose() |
void |
drawTile(Graphics g,
int tileId,
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 |
com.badlogic.gdx.utils.Array<com.badlogic.gdx.assets.AssetDescriptor> |
getDependencies(com.badlogic.gdx.files.FileHandle tmxPath)
Returns the
AssetManager dependencies for this tileset |
int |
getFirstGid()
Returns the first GID.
|
int |
getHeight()
Returns the height of this tileset in pixels
|
int |
getHeightInTiles()
Returns the height of this tileset 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)
Returns the
Tile for a given tile id |
Tile |
getTile(int x,
int y)
Returns the
Tile for a given tile coordinate on the tileset |
int |
getTileHeight()
Returns the height of each tile in pixels
|
int |
getTileId(int x,
int y)
Returns the tile ID for a given tile within this tileset
|
int |
getTileWidth()
Returns the width of each tile in pixels
|
int |
getTileX(int tileId)
Returns the x coordinate of a tile within this tileset
|
int |
getTileY(int tileId)
Returns the y coordinate of a tile within this tileset
|
int |
getWidth()
Returns the width of this tileset in pixels
|
int |
getWidthInTiles()
Returns the width of this tileset in tiles
|
boolean |
isTextureLoaded()
Returns if the tileset image has been loaded
|
void |
loadTexture(com.badlogic.gdx.assets.AssetManager assetManager,
com.badlogic.gdx.files.FileHandle tmxPath)
Loads the tileset image
|
void |
loadTexture(com.badlogic.gdx.files.FileHandle tmxPath)
Loads the tileset image
|
void |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value of a specified property
|
public Tileset(int firstGid,
TilesetSource tilesetSource)
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 java.util.Map<java.lang.String,java.lang.String> getProperties()
Map of this Tilesetpublic void drawTile(Graphics g, int tileId, int renderX, int renderY)
Graphics contextg - The Graphics context available for renderingtileId - The tile id to renderrenderX - The X coordinate to render atrenderY - The Y coordinate to render atpublic void drawTileset(Graphics g, int renderX, int renderY)
Graphics contextg - The Graphics context available for renderingrenderX - The X coordinate to render atrenderY - The Y coordinate to render atpublic Tile getTile(int tileId)
Tile for a given tile idtileId - The tile id to look upTilepublic Tile getTile(int x, int y)
Tile for a given tile coordinate on the tilesetx - The x coordinate in tilesy - The y coordinate in tilesTilepublic com.badlogic.gdx.utils.Array<com.badlogic.gdx.assets.AssetDescriptor> getDependencies(com.badlogic.gdx.files.FileHandle tmxPath)
AssetManager dependencies for this tilesettmxPath - The path of the TMX filepublic boolean isTextureLoaded()
public void loadTexture(com.badlogic.gdx.files.FileHandle tmxPath)
tmxPath - The path of the TMX file for the TiledMap that has
loaded this tilesetpublic void loadTexture(com.badlogic.gdx.assets.AssetManager assetManager,
com.badlogic.gdx.files.FileHandle tmxPath)
assetManager - The AssetManager to usetmxPath - The path of the TMX file for the TiledMap that has
loaded this tilesetpublic void dispose()
dispose in interface com.badlogic.gdx.utils.Disposablepublic boolean contains(int tileId)
tileId - The tile id to search forpublic int getTileId(int x,
int y)
x - The x coordinate of the tile on the tilesety - The y coordinate of the tile on the tilesetpublic int getTileX(int tileId)
tileId - The tile id to get the x coordinate forpublic int getTileY(int tileId)
tileId - The tile id to get the y coordinate forpublic int getWidthInTiles()
public int getHeightInTiles()
public int getWidth()
public int getHeight()
public int getTileWidth()
public int getTileHeight()
public int getSpacing()
public int getMargin()
public int getFirstGid()