Class Tileset
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
de.gurkenlabs.litiengine.environment.tilemap.xml.Tileset
- All Implemented Interfaces:
ICustomPropertyProvider, ITileset, Resource, Comparable<Resource>
The
Tileset class represents a collection of tiles used in a tile-based map. It extends the CustomPropertyProvider class and
implements the ITileset interface. This class provides various properties and methods to manage and access tileset information.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsTile(int tileId) Returns whether this tileset contains a tile with the supplied global id.booleancontainsTile(ITile tile) Returns whether this tileset contains the supplied tile.booleancontainsTile(ITilesetEntry entry) Returns whether this tileset contains the supplied tileset entry.voidvoidcopyTerrainSetsFrom(Tileset original) voidenrichTerrainMetadataFrom(Tileset original) voidintGets the number of tile columns in the tileset.Gets the fill mode.intGets the first grid id.getImage()Gets the image.intGets the margin.getName()Gets the name of the resource.Gets the object alignment.Returns aMapview of the custom properties for thisICustomPropertyProvider.intGets the spacing.Gets the spritesheet that contains the rendered tile images.Gets the terrain sets defined by this tile set.getTile(int id) Gets the tileset entry with the given local id.intGets the total number of tiles defined by this tileset.Gets the tile dimension.intGets the tile height.Gets the per-tileset rendering offset.Gets the tile render size.Gets the tileset class.intGets the tile width.Gets the tile transformations.booleanChecks if the tileset is external.voidLoads the source tileset from the provided list of raw tilesets.voidsaveSource(Path path) Saves the source tileset to the specified base path.voidsetColumns(int columns) voidsetFillmode(String fillmode) voidsetFirstGridId(int firstGridId) Sets the first global tile ID used by this tileset in its containing map.voidvoidsetMargin(int margin) voidSets the name of the resource.voidsetObjectalignment(String objectalignment) voidvoidsetSpacing(int spacing) voidsetTileCount(int tileCount) voidsetTileHeight(int tileHeight) voidsetTileOffset(int x, int y) voidsetTilerendersize(String tilerendersize) voidsetTileWidth(int tileWidth) Methods inherited from class CustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getCharValue, getCharValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getMapObjectId, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, hasCustomProperty, removeProperty, setProperties, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ICustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getCharValue, getCharValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getMapObjectId, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, hasCustomProperty, removeProperty, setProperties, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
-
Field Details
-
FILE_EXTENSION
- See Also:
-
sourceTileset
-
-
Constructor Details
-
Tileset
public Tileset()Default constructor for theTilesetclass. Initializes a new instance of theTilesetclass and sets up a listener to clear the sprite sheet when images are cleared. -
Tileset
Copy constructor for theTilesetclass. Creates a new instance of theTilesetclass by copying the properties from the providedTilesetobject.- Parameters:
original- The originalTilesetobject to copy from.
-
Tileset
Creates a map-local copy of a tileset with the supplied first global tile ID.- Parameters:
original- the project tileset to copyfirstGridId- the first global tile ID assigned to the copy
-
-
Method Details
-
copyFrom
-
copyTerrainSetsFrom
-
enrichTerrainMetadataFrom
-
getProperties
Description copied from interface:ICustomPropertyProviderReturns aMapview of the custom properties for thisICustomPropertyProvider.- Specified by:
getPropertiesin interfaceICustomPropertyProvider- Overrides:
getPropertiesin classCustomPropertyProvider- Returns:
- a
Mapview of the custom properties for thisICustomPropertyProvider
-
getFirstGridId
public int getFirstGridId()Description copied from interface:ITilesetGets the first grid id.- Specified by:
getFirstGridIdin interfaceITileset- Returns:
- the first grid id
-
setFirstGridId
public void setFirstGridId(int firstGridId) Sets the first global tile ID used by this tileset in its containing map.- Parameters:
firstGridId- the first global tile ID, starting at1
-
getImage
-
setImage
-
setMargin
public void setMargin(int margin) -
setSpacing
public void setSpacing(int spacing) -
getMargin
-
getName
-
getSource
-
getSourceTileset
-
setName
-
setSource
-
getSpacing
public int getSpacing()Gets the spacing.- Specified by:
getSpacingin interfaceITileset- Returns:
- the spacing
-
getSpritesheet
Description copied from interface:ITilesetGets the spritesheet that contains the rendered tile images.- Specified by:
getSpritesheetin interfaceITileset- Returns:
- the spritesheet
-
getTileDimension
Description copied from interface:ITilesetGets the tile dimension.- Specified by:
getTileDimensionin interfaceITileset- Returns:
- the tile dimension
-
getTileHeight
public int getTileHeight()Gets the tile height.- Specified by:
getTileHeightin interfaceITileset- Returns:
- the tile height
-
getTileWidth
public int getTileWidth()Gets the tile width.- Specified by:
getTileWidthin interfaceITileset- Returns:
- the tile width
-
setTileWidth
public void setTileWidth(int tileWidth) -
getColumns
public int getColumns()Description copied from interface:ITilesetGets the number of tile columns in the tileset.- Specified by:
getColumnsin interfaceITileset- Returns:
- the number of columns
-
setTileHeight
public void setTileHeight(int tileHeight) -
setColumns
public void setColumns(int columns) -
setTileCount
public void setTileCount(int tileCount) -
getTileOffset
Description copied from interface:ITilesetGets the per-tileset rendering offset.- Specified by:
getTileOffsetin interfaceITileset- Returns:
- the tile offset
-
setTileOffset
public void setTileOffset(int x, int y) -
getTileCount
public int getTileCount()Description copied from interface:ITilesetGets the total number of tiles defined by this tileset.- Specified by:
getTileCountin interfaceITileset- Returns:
- the tile count
-
getTile
Description copied from interface:ITilesetGets the tileset entry with the given local id. -
getTransformations
Gets the tile transformations.- Returns:
- the tile transformations
-
getTilesetClass
-
getObjectalignment
-
setObjectalignment
-
getTilerendersize
-
setTilerendersize
-
getFillmode
-
setFillmode
-
containsTile
Description copied from interface:ITilesetReturns whether this tileset contains the supplied tile.- Specified by:
containsTilein interfaceITileset- Parameters:
tile- the tile to test- Returns:
trueif this tileset contains the tile
-
containsTile
public boolean containsTile(int tileId) Description copied from interface:ITilesetReturns whether this tileset contains a tile with the supplied global id.- Specified by:
containsTilein interfaceITileset- Parameters:
tileId- the global tile id- Returns:
trueif the global id belongs to this tileset
-
getTerrainSets
Description copied from interface:ITilesetGets the terrain sets defined by this tile set.- Specified by:
getTerrainSetsin interfaceITileset- Returns:
- The terrain sets of this instance.
-
getOrCreateTerrainSets
-
containsTile
Description copied from interface:ITilesetReturns whether this tileset contains the supplied tileset entry.- Specified by:
containsTilein interfaceITileset- Parameters:
entry- the entry to test- Returns:
trueif this tileset contains the entry
-
finish
- Throws:
TmxException
-
saveSource
Saves the source tileset to the specified base path.- Parameters:
path- The base path where the source tileset should be saved.
-
isExternal
public boolean isExternal()Checks if the tileset is external.- Returns:
- true if the tileset is external, false otherwise.
-
load
-