public class Tileset
extends java.lang.Object
TiledMap
Constructor and Description |
---|
Tileset(int width,
int height,
int tileWidth,
int tileHeight,
int spacing,
int margin,
int firstGid) |
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 |
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 |
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.lang.String |
getName()
Returns the name of this 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
|
java.lang.String |
getTilesetImagePath()
Returns the relative path of the tileset image
|
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
|
java.lang.String |
getTransparentColorValue() |
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.files.FileHandle tmxDirectory)
Loads the tileset image
|
void |
setName(java.lang.String name)
Sets the name of this tileset
|
void |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value of a specified property
|
void |
setTilesetImagePath(java.lang.String tilesetImagePath)
Sets the relative path of the tileset image
|
void |
setTransparentColorValue(java.lang.String transparentColorValue) |
public Tileset(int width, int height, int tileWidth, int tileHeight, int spacing, int margin, int firstGid)
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 Tileset
public 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 upTile
public Tile getTile(int x, int y)
Tile
for a given tile coordinate on the tilesetx
- The x coordinate in tilesy
- The y coordinate in tilesTile
public boolean isTextureLoaded()
public void loadTexture(com.badlogic.gdx.files.FileHandle tmxDirectory)
tmxDirectory
- The directory containing the TMX files for the
TiledMap
that has loaded this tilesetpublic 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 java.lang.String getName()
public void setName(java.lang.String name)
name
- The name to setpublic int getWidth()
public int getHeight()
public int getTileWidth()
public int getTileHeight()
public int getSpacing()
public int getMargin()
public int getFirstGid()
public java.lang.String getTilesetImagePath()
public void setTilesetImagePath(java.lang.String tilesetImagePath)
tilesetImagePath
- public java.lang.String getTransparentColorValue()
public void setTransparentColorValue(java.lang.String transparentColorValue)