Package-level declarations

Types

Link copied to clipboard
class MissingLayerException(message: String, cause: Throwable? = null) : TiledException

GdxRuntimeException that is thrown when trying to access a non-existing MapLayer of a TiledMap instance.

Link copied to clipboard
class MissingPropertyException(message: String, cause: Throwable? = null) : TiledException

GdxRuntimeException that is thrown when trying to access a non-existing property of a MapProperties instance.

Link copied to clipboard
class MissingShapeException(message: String, cause: Throwable? = null) : TiledException

GdxRuntimeException that is thrown when trying to access a shape of a MapObject that do not have any shape such as the TextureMapObject.

Link copied to clipboard
open class TiledException(message: String, cause: Throwable? = null) : GdxRuntimeException

Common type of exceptions thrown by the Tiled API extensions.

Properties

Link copied to clipboard
val TiledMap.backgroundColor: String?

Extension property to retrieve the background color of the TiledMap. Null if property was not set.

Link copied to clipboard
val MapObject.height: Float

Extension property to retrieve the height of the MapObject.

val TiledMap.height: Int

Extension property to retrieve the height of the TiledMap.

Link copied to clipboard
val TiledMap.hexSideLength: Int

Extension property to retrieve the hex side length of a hexagonal TiledMap.

Link copied to clipboard
val MapObject.id: Int

Extension property to retrieve the unique ID of the MapObject.

Link copied to clipboard
val TiledMap.orientation: String

Extension property to retrieve the orientation of the TiledMap.

Link copied to clipboard
val MapObject.rotation: Float?

Extension property to retrieve the rotation of the MapObject. Null if the property is unset.

Link copied to clipboard
val MapObject.shape: Shape2D

Extension method to retrieve the Shape2D instance of a MapObject. Depending on the type of the object a different shape will be returned:

Link copied to clipboard
val TiledMap.staggerAxis: String

Extension property to retrieve the stagger axis of the TiledMap.

Link copied to clipboard
val TiledMap.staggerIndex: String

Extension property to retrieve the stagger index of the TiledMap.

Link copied to clipboard
val TiledMap.tileHeight: Int

Extension property to retrieve the tile height of each tile of the TiledMap.

Link copied to clipboard
val TiledMap.tileWidth: Int

Extension property to retrieve the tile width of each tile of the TiledMap.

Link copied to clipboard
val MapObject.type: String?

Extension property to retrieve the type of the MapObject. Null if the property is unset.

Link copied to clipboard
val MapObject.width: Float

Extension property to retrieve the width of the MapObject.

val TiledMap.width: Int

Extension property to retrieve the width of the TiledMap.

Link copied to clipboard
val MapObject.x: Float

Extension property to retrieve the x-coordinate of the MapObject.

Link copied to clipboard
val MapObject.y: Float

Extension property to retrieve the y-coordinate of the MapObject.

Functions

Link copied to clipboard
operator fun MapProperties.contains(key: String): Boolean

Allows to check if a MapProperties instance contains a property mapped to key with Kotlin in operator.

operator fun TiledMap.contains(layerName: String): Boolean

Extension operator to check if a certain MapLayer is part of the TiledMap

Link copied to clipboard
fun MapLayer.containsProperty(key: String): Boolean

Extension method to directly access the MapProperties of a MapLayer and its containsKey method.

fun MapObject.containsProperty(key: String): Boolean

Extension method to directly access the MapProperties of a MapObject and its containsKey method.

fun TiledMap.containsProperty(key: String): Boolean

Extension method to directly access the MapProperties of a TiledMap and its containsKey method.

fun TiledMapTile.containsProperty(key: String): Boolean

Extension method to directly access the MapProperties of a TiledMapTile and its containsKey method.

fun TiledMapTileSet.containsProperty(key: String): Boolean

Extension method to directly access the MapProperties of a TiledMapTileSet and its containsKey method.

Link copied to clipboard
inline fun <T : MapLayer> TiledMap.forEachLayer(action: (T) -> Unit)

Extension method to run an action on a specific type of layers of the TiledMap. The lambda takes the matching MapLayer as a parameter.

Link copied to clipboard
inline fun TiledMap.forEachMapObject(layerName: String, action: (MapObject) -> Unit)

Extension method to easily execute an action per MapObject of a given MapLayer. If the layer does not exist then nothing is happening.

Link copied to clipboard
fun MapLayers.isEmpty(): Boolean

Returns true if and only if the MapLayers collection is empty.

fun MapObjects.isEmpty(): Boolean

Returns true if and only if the MapObjects collection is empty.

Link copied to clipboard
fun MapLayers.isNotEmpty(): Boolean

Returns true if and only if the MapLayers collection is not empty.

fun MapObjects.isNotEmpty(): Boolean

Returns true if and only if the MapObjects collection is not empty.

Link copied to clipboard
fun TiledMap.layer(layerName: String): MapLayer

Extension method to retrieve a MapLayer of a TiledMap. If the layer does not exist then this method is throwing a MissingLayerException

Link copied to clipboard
inline fun <T> MapLayer.property(key: String): T

Extension method to directly access the MapProperties of a MapLayer. If the property is not defined then this method throws a MissingPropertyException.

inline fun <T> MapObject.property(key: String): T

Extension method to directly access the MapProperties of a MapObject. If the property is not defined then this method throws a MissingPropertyException.

inline fun <T> TiledMap.property(key: String): T

Extension method to directly access the MapProperties of a TiledMap. If the property is not defined then this method throws a MissingPropertyException.

inline fun <T> TiledMapTile.property(key: String): T

Extension method to directly access the MapProperties of a TiledMapTile. If the property is not defined then this method throws a MissingPropertyException.

inline fun <T> TiledMapTileSet.property(key: String): T

Extension method to directly access the MapProperties of a TiledMapTileSet. If the property is not defined then this method throws a MissingPropertyException.

inline fun <T> MapLayer.property(key: String, defaultValue: T): T

Extension method to directly access the MapProperties of a MapLayer. The type is automatically derived from the type of the given default value. If the property is not defined the defaultValue will be returned.

inline fun <T> MapObject.property(key: String, defaultValue: T): T

Extension method to directly access the MapProperties of a MapObject. The type is automatically derived from the type of the given default value. If the property is not defined the defaultValue will be returned.

inline fun <T> TiledMap.property(key: String, defaultValue: T): T

Extension method to directly access the MapProperties of a TiledMap. The type is automatically derived from the type of the given default value. If the property is not defined the defaultValue will be returned.

inline fun <T> TiledMapTile.property(key: String, defaultValue: T): T

Extension method to directly access the MapProperties of a TiledMapTile. The type is automatically derived from the type of the given default value. If the property is not defined the defaultValue will be returned.

inline fun <T> TiledMapTileSet.property(key: String, defaultValue: T): T

Extension method to directly access the MapProperties of a TiledMapTileSet. The type is automatically derived from the type of the given default value. If the property is not defined the defaultValue will be returned.

Link copied to clipboard
inline fun <T> MapLayer.propertyOrNull(key: String): T?

Extension method to directly access the MapProperties of a MapLayer. If the property is not defined then this method returns null.

inline fun <T> MapObject.propertyOrNull(key: String): T?

Extension method to directly access the MapProperties of a MapObject. If the property is not defined then this method returns null.

inline fun <T> TiledMap.propertyOrNull(key: String): T?

Extension method to directly access the MapProperties of a TiledMap. If the property is not defined then this method returns null.

inline fun <T> TiledMapTile.propertyOrNull(key: String): T?

Extension method to directly access the MapProperties of a TiledMapTile. If the property is not defined then this method returns null.

inline fun <T> TiledMapTileSet.propertyOrNull(key: String): T?

Extension method to directly access the MapProperties of a TiledMapTileSet. If the property is not defined then this method returns null.

Link copied to clipboard
operator fun MapProperties.set(key: String, value: Any)

Allows to add a property mapped to key with given value using Kotlin square braces assignment operator.

Link copied to clipboard
fun TiledMap.totalHeight(): Int

Extension method to retrieve the total height of the TiledMap. It is the result of the height multiplied by the tile height of the map.

Link copied to clipboard
fun TiledMap.totalWidth(): Int

Extension method to retrieve the total width of the TiledMap. It is the result of the width multiplied by the tile width of the map.

Link copied to clipboard
inline fun <T : BatchTiledMapRenderer> T.use(block: (T) -> Unit)
inline fun <T : BatchTiledMapRenderer> T.use(camera: OrthographicCamera, block: (T) -> Unit)
inline fun <T : BatchTiledMapRenderer> T.use(projection: Matrix4, mapBoundary: Rectangle, block: (T) -> Unit)
inline fun <T : BatchTiledMapRenderer> T.use(projection: Matrix4, x: Float, y: Float, width: Float, height: Float, block: (T) -> Unit)

Automatically calls BatchTiledMapRenderer.beginRender and BatchTiledMapRenderer.endRender.