Package-level declarations

Types

Link copied to clipboard
@Serializable
data class DefaultOverrideInfo(val id: String, val params: List<MultiAssociatedValue>)
Link copied to clipboard
@Serializable
data class Definitions(val entities: List<LDtkEntityDefinition>, val enums: List<LDtkEnumDefinition>, val externalEnums: List<LDtkEnumDefinition>, val layers: List<LDtkLayerDefinition>, val levelFields: List<LDtkFieldDefinition>, val tilesets: List<LDtkTilesetDefinition>)

A structure containing all the definitions of this project

Link copied to clipboard
@Serializable
enum LDtkBgPos : Enum<LDtkBgPos>
Link copied to clipboard
@Serializable
data class LDtkEntityDefinition(val color: String, val fieldDefs: List<LDtkFieldDefinition>, val fillOpacity: Float, val height: Int, val hollow: Boolean, val identifier: String, val keepAspectRatio: Boolean, val lineOpacity: Float, val maxCount: Int, val pivotX: Float, val pivotY: Float, val resizableX: Boolean, val resizableY: Boolean, val showName: Boolean, val tags: List<String>, val tileID: Int? = null, val tilesetID: Int? = null, val uid: Int, val width: Int, val tileRect: LDtkTileRect? = null)
Link copied to clipboard
@Serializable
data class LDtkEntityInstance(val grid: List<Int>, val identifier: String, val pivot: List<Float>, val tile: LDtkTileRect? = null, val defUid: Int, val fieldInstances: List<LDtkFieldInstance>, val height: Int, val px: List<Int>, val width: Int, val tags: List<String> = emptyList(), val iid: String = "")
Link copied to clipboard
@Serializable
data class LDtkEnumDefinition(val externalFileChecksum: String? = null, val externalRelPath: String? = null, val iconTilesetUid: Int? = null, val identifier: String, val uid: Int, val values: List<LDtkEnumValueDefinition>, val tags: List<String> = emptyList())
Link copied to clipboard
@Serializable
data class LDtkEnumValueDefinition(val tileSrcRect: List<Int>?, val id: String, val tileID: Int? = null, val color: Int)
Link copied to clipboard
@Serializable
data class LDtkFieldDefinition(val type: String, val acceptFileTypes: List<String>? = null, val arrayMaxLength: Int? = null, val arrayMinLength: Int? = null, val canBeNull: Boolean, val defaultOverride: DefaultOverrideInfo? = null, val identifier: String, val isArray: Boolean, val max: Float? = null, val min: Float? = null, val regex: String? = null, val uid: Int)

This section is mostly only intended for the LDtk editor app itself. You can safely ignore it.

Link copied to clipboard
@Serializable
data class LDtkFieldInstance(val identifier: String, val type: String, val value: MultiAssociatedValue?, val defUid: Int, val tile: LDtkTileRect? = null)
Link copied to clipboard
@Serializable
data class LDtkIntGridValueDefinition(val color: String, val identifier: String? = null, val value: Int)

IntGrid value definition

Link copied to clipboard
@Serializable
data class LDtkIntGridValueInstance(val coordID: Int, val v: Int)

IntGrid value instance

Link copied to clipboard
@Serializable
data class LDtkLayerDefinition(val type: String, val autoRuleGroups: JsonArray, val autoSourceLayerDefUid: Int? = null, val autoTilesetDefUid: Int? = null, val displayOpacity: Float, val excludedTags: List<String>, val gridSize: Int, val identifier: String, val intGridValues: List<LDtkIntGridValueDefinition>, val pxOffsetX: Int, val pxOffsetY: Int, val requiredTags: List<String>, val tilePivotX: Float, val tilePivotY: Float, val tilesetDefUid: Int? = null, val layerDefinitionType: LDtkLayerType, val uid: Int, val parallaxFactorX: Float = 0.0f, val parallaxFactorY: Float = 0.0f, val parallaxScaling: Boolean = false)
Link copied to clipboard
@Serializable
data class LDtkLayerInstance(val cHei: Int, val cWid: Int, val gridSize: Int, val identifier: String, val opacity: Float, val pxTotalOffsetX: Int, val pxTotalOffsetY: Int, val tilesetDefUid: Int? = null, val tilesetRelPath: String? = null, val type: String, val autoLayerTiles: List<LDtkTileInstance>, val entityInstances: List<LDtkEntityInstance>, val gridTiles: List<LDtkTileInstance>, val intGrid: List<LDtkIntGridValueInstance>? = null, val intGridCSV: List<Int>?, val layerDefUid: Int, val levelID: Int, val overrideTilesetUid: Int? = null, val pxOffsetX: Int, val pxOffsetY: Int, val seed: Int, val visible: Boolean, val iid: String = "")
Link copied to clipboard
@Serializable
enum LDtkLayerType : Enum<LDtkLayerType>

Type of the layer as enum possible values: IntGrid, Entities, Tiles, AutoLayer

Link copied to clipboard
@Serializable
data class LDtkLevelBackgroundPositionData(val cropRect: List<Float>, val scale: List<Float>, val topLeftPx: List<Int>)

Level background image position info

Link copied to clipboard
@Serializable
data class LDtkLevelDefinition(val bgColor: String, val bgPos: LDtkLevelBackgroundPositionData? = null, val neighbours: List<LDtkNeighbourLevelData>?, val levelBgColor: String? = null, val bgPivotX: Float, val bgPivotY: Float, val levelBgPos: LDtkBgPos? = null, val bgRelPath: String? = null, val externalRelPath: String? = null, val fieldInstances: List<LDtkFieldInstance>, val identifier: String, val layerInstances: List<LDtkLayerInstance>? = null, val pxHei: Int, val pxWid: Int, val uid: Int, val worldX: Int, val worldY: Int, val iid: String = "", val worldDepth: Int = 0)

This section contains all the level data. It can be found in 2 distinct forms, depending on Project current settings: - If "Separate level files" is disabled (default): full level data is embedded inside the main Project JSON file, - If "Separate level files" is enabled: level data is stored in separate standalone .ldtkl files (one per level). In this case, the main Project JSON file will still contain most level data, except heavy sections, like the layerInstances array (which will be null). The externalRelPath string points to the ldtkl file. A ldtkl file is just a JSON file containing exactly what is described below.

Link copied to clipboard
@Serializable
data class LDtkMapData(val bgColor: String, val defaultGridSize: Int, val defaultLevelBgColor: String, val defaultLevelHeight: Int, val defaultLevelWidth: Int, val defaultPivotX: Float, val defaultPivotY: Float, val defs: Definitions, val exportTiled: Boolean, val externalLevels: Boolean, val jsonVersion: String, val levelDefinitions: List<LDtkLevelDefinition>, val minifyJSON: Boolean, val nextUid: Int, val pngFilePattern: String? = null, val worldGridHeight: Int? = null, val worldGridWidth: Int? = null, val worldLayout: LDtkWorldLayout? = null, val worlds: List<LDtkWorldData> = emptyList())

This file is a JSON schema of files created by LDtk level editor (https://ldtk.io).

Link copied to clipboard
class LDtkMapLoader(root: VfsFile, mapData: LDtkMapData, atlas: TextureAtlas? = null, tilesetBorder: Int = 2) : Disposable
Link copied to clipboard
@Serializable
data class LDtkNeighbourLevelData(val dir: String, val levelIid: String = "", val levelUid: Int = 0)

Nearby level info

Link copied to clipboard
@Serializable
data class LDtkTileInstance(val d: List<Int>, val f: Int, val px: List<Int>, val src: List<Int>, val t: Int)

This structure represents a single tile from a given Tileset.

Link copied to clipboard
@Serializable
data class LDtkTileRect(val srcRect: List<Int> = emptyList(), val tilesetUid: Int, val h: Int = 0, val w: Int = 0, val x: Int = 0, val y: Int = 0)

Tile data in an Entity instance

Link copied to clipboard
@Serializable
data class LDtkTilesetDefinition(val identifier: String, val padding: Int, val pxHei: Int, val pxWid: Int, val relPath: String, val spacing: Int, val tileGridSize: Int, val uid: Int, val embedAtlas: String? = null)

The Tileset definition is the most important part among project definitions. It contains some extra info about each integrated tileset. If you only had to parse one definition section, that would be the one.

Link copied to clipboard
@Serializable
data class LDtkWorldData(val identifier: String, val iid: String = "", val levelDefinitions: List<LDtkLevelDefinition>, val worldGridHeight: Int, val worldGridWidth: Int, val worldLayout: LDtkWorldLayout)
Link copied to clipboard
@Serializable
enum LDtkWorldLayout : Enum<LDtkWorldLayout>

An enum that describes how levels are organized in this project (ie. linearly or in a 2D space). Possible values: Free, GridVania, LinearHorizontal, LinearVertical

Link copied to clipboard
data class MultiAssociatedValue(val stringList: List<String>? = null, val stringMapList: List<Map<String, String>>? = null, val stringMap: Map<String, String>? = null, val content: String? = null)