public abstract class TilesetSource
extends java.lang.Object
implements org.mini2Dx.gdx.utils.Disposable
Constructor and Description |
---|
TilesetSource() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int tileId,
int firstGid,
int lastGid)
Returns true if a tileset contains the tile with the given id
|
abstract boolean |
containsProperty(java.lang.String propertyName)
Returns if the tileset contains the specified property
|
abstract void |
drawTile(Graphics g,
int tileId,
int firstGid,
int renderX,
int renderY)
Draws a tile to the
Graphics context |
abstract void |
drawTileset(Graphics g,
int renderX,
int renderY)
Draws the whole tileset to the
Graphics context |
boolean |
equals(java.lang.Object obj) |
abstract org.mini2Dx.gdx.utils.Array<AssetDescriptor> |
getDependencies(FileHandle tmxPath)
Returns the dependencies of this source
|
abstract int |
getHeight()
Returns the height of this tileset in pixels
|
abstract int |
getHeightInTiles()
Returns the height of this source in tiles
|
abstract java.lang.String |
getInternalUuid()
Returns a UUID generated by mini2Dx
|
abstract int |
getMargin()
Returns the margin at the borders of the tileset
|
abstract org.mini2Dx.gdx.utils.ObjectMap<java.lang.String,java.lang.String> |
getProperties()
Returns the properties
ObjectMap of this Tileset |
abstract java.lang.String |
getProperty(java.lang.String propertyName)
Returns the value of a specified property
|
abstract int |
getSpacing()
Returns the internal spacing between each tile
|
abstract Tile |
getTile(int tileId,
int firstGid)
Returns the
Tile for a given tile id |
abstract Tile |
getTileByPosition(int x,
int y)
Returns the
Tile for a given x/y coordinate with the tileset
source |
abstract int |
getTileHeight()
Returns the height of each tile in pixels
|
int |
getTileId(int x,
int y,
int firstGid)
Returns the tile ID for a given tile within a tileset
|
abstract Sprite |
getTileImage(int tileId)
Returns the
Sprite for a given tile |
Sprite |
getTileImage(int tileId,
int firstGid)
Returns the
Sprite for a given tile |
abstract int |
getTileWidth()
Returns the width of each tile in pixels
|
int |
getTileX(int tileId,
int firstGid)
Returns the x coordinate of a tile within a tileset
|
int |
getTileY(int tileId,
int firstGid)
Returns the y coordinate of a tile within a tileset
|
abstract int |
getWidth()
Returns the width of this tileset in pixels
|
abstract int |
getWidthInTiles()
Returns the width of this source in tiles
|
abstract boolean |
isTextureLoaded()
Returns if the tileset texture image is loaded
|
abstract void |
loadTexture(AssetManager assetManager,
FileHandle tmxPath)
Loads the tileset's texture image
|
abstract void |
loadTexture(FileHandle tmxPath)
Loads the tileset's texture image
|
abstract void |
loadTexture(TextureAtlas textureAtlas)
Loads the texture from a
TextureAtlas |
abstract void |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value of a specified property
|
public int getTileId(int x, int y, int firstGid)
x
- The x coordinate of the tile on a tilesety
- The y coordinate of the tile on a tilesetfirstGid
- The first gid of the tilesetpublic int getTileX(int tileId, int firstGid)
tileId
- The tile id to get the x coordinate forfirstGid
- The first gid of the tilesetpublic int getTileY(int tileId, int firstGid)
tileId
- The tile id to get the y coordinate forfirstGid
- The first gid of the tilesetpublic boolean contains(int tileId, int firstGid, int lastGid)
tileId
- The tile id to search forfirstGid
- The first gid of the tilesetlastGid
- The last gid of the tilesetpublic abstract org.mini2Dx.gdx.utils.Array<AssetDescriptor> getDependencies(FileHandle tmxPath)
tmxPath
- The path of the TMX filepublic abstract void loadTexture(FileHandle tmxPath)
tmxPath
- The path of the TMX filepublic abstract void loadTexture(AssetManager assetManager, FileHandle tmxPath)
assetManager
- The AssetManager
to usetmxPath
- The path of the TMX filepublic abstract void loadTexture(TextureAtlas textureAtlas)
TextureAtlas
textureAtlas
- The TextureAtlas
to usepublic abstract boolean isTextureLoaded()
public abstract Sprite getTileImage(int tileId)
Sprite
for a given tiletileId
- The tile id to retrieveSprite
or null if that textures haven't been loadedpublic Sprite getTileImage(int tileId, int firstGid)
Sprite
for a given tiletileId
- The tile id to retrievefirstGid
- The first gid of the tilesetSprite
or null if that textures haven't been loadedpublic abstract void drawTile(Graphics g, int tileId, int firstGid, int renderX, int renderY)
Graphics
contextg
- 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 abstract 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 abstract Tile getTile(int tileId, int firstGid)
Tile
for a given tile idtileId
- The tile id to look upfirstGid
- The first gid for the tilesetTile
public abstract Tile getTileByPosition(int x, int y)
Tile
for a given x/y coordinate with the tileset
sourcex
- The x coordinate of the tile within the tileset (in tiles)y
- The y coordinate of the tile within the tileset (in tiles)Tile
public abstract int getWidth()
public abstract int getHeight()
public abstract int getTileWidth()
public abstract int getTileHeight()
public abstract int getWidthInTiles()
public abstract int getHeightInTiles()
public abstract int getSpacing()
public abstract int getMargin()
public abstract boolean containsProperty(java.lang.String propertyName)
propertyName
- The property name to search forpublic abstract java.lang.String getProperty(java.lang.String propertyName)
propertyName
- The property name to search forpublic abstract 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 abstract org.mini2Dx.gdx.utils.ObjectMap<java.lang.String,java.lang.String> getProperties()
ObjectMap
of this Tileset
public abstract java.lang.String getInternalUuid()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object