Expand description
Contains all the types for serializing/deserializing an LDtk file.
This is mostly based on LDtk’s existing rust QuickType loader.
For the most part, changes to the generated module are avoided to make it simpler to maintain this plugin in the future. However, some usability concerns have been addressed. Any changes should be documented here for maintenance purposes:
- Comment at the top of the file has been replaced with this documentation.
- All enums have Default derived. The first variant is selected as default, exception for LimitBehavior, LimitScope, RenderMode, TileRenderMode, and Type.
- Copy, Default, Eq, PartialEq, and Reflect have been derived wherever possible.
- i64 and f64 have been changed to i32 and f32.
Component
has been derived for EntityInstance.- Documentation added for EntityInstance, which required the unused import of LdtkEntity.
- FieldInstance has been moved to its own module, and is re-exported here.
- Some “coordinate” fields on LevelBackgroundPosition, EntityInstance, and TileInstance have been changed from vectors to IVec2 and Vec2.
- Some “color” fields on LdtkJson, EntityDefinition, IntGridValueDefinition, LayerDefinition, Level, and EntityInstance have been changed from Strings to Color. They also are given a serde attribute for using the “color” or “color::optional” modules.
- All urls in docs have been changed to hyperlinks with
<>
From<&EntityInstance>
implemented forEntityInstance
LayerInstance::layer_instance_type
changed fromString
toType
.
Modules§
- all_
some_ iter - Contains
AllSomeIter
, for coercing a slice of options to anIterator
of non-options. - ldtk_
fields - Contains
LdtkFields
trait, providing convenience methods for accessing field instances. - loaded_
level - Contains
LoadedLevel
and related types/implementaions. - raw_
level_ accessor - Contains
RawLevelAccessor
: convenience methods for accessing raw level data by reference.
Structs§
- Auto
Layer Rule Definition - This complex section isn’t meant to be used by game devs at all, as these rules are completely resolved internally by the editor before any saving. You should just ignore this part.
- Auto
Layer Rule Group - Definitions
- If you’re writing your own LDtk importer, you should probably just ignore most stuff in
the
defs
section, as it contains data that are mostly important to the editor. To keep you away from thedefs
section and avoid some unnecessary JSON parsing, important data from definitions is often duplicated in fields prefixed with a double underscore (eg.__identifier
or__type
). The 2 only definition types you might need here are Tilesets and Enums. - Entity
Definition - Entity
Instance - Component added to any LDtk Entity by default.
- Enum
Definition - Enum
TagValue - In a tileset definition, enum based tag infos
- Enum
Value Definition - Field
Definition - This section is mostly only intended for the LDtk editor app itself. You can safely ignore it.
- Field
Instance - Forced
Refs - This object is not actually used by LDtk. It ONLY exists to force explicit references to all types, to make sure QuickType finds them and integrate all of them. Otherwise, Quicktype will drop types that are not explicitely used.
- Grid
Point - This object is just a grid-based coordinate used in Field values.
- IntGrid
Value Definition - IntGrid value definition
- IntGrid
Value Group Definition - IntGrid value group definition
- IntGrid
Value Instance - IntGrid value instance
- Layer
Definition - Layer
Instance - Ldtk
Custom Command - Ldtk
Json - This file is a JSON schema of files created by LDtk level editor (https://ldtk.io).
- Ldtk
Table OfContent Entry - Ldtk
TocInstance Data - Level
- 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 thelayerInstances
array (which will be null). TheexternalRelPath
string points to theldtkl
file. Aldtkl
file is just a JSON file containing exactly what is described below. - Level
Background Position - Level background image position info
- Neighbour
Level - Nearby level info
- Reference
ToAn Entity Instance - This object describes the “location” of an Entity instance in the project worlds.
- Tile
Custom Metadata - In a tileset definition, user defined meta-data of a tile.
- Tile
Instance - This structure represents a single tile from a given Tileset.
- Tileset
Definition - The
Tileset
definition is the most important part among project definitions. It contains some extra informations about each integrated tileset. If you only had to parse one definition section, that would be the one. - Tileset
Rectangle - This object represents a custom sub rectangle in a Tileset image.
- World
- IMPORTANT: this type is available as a preview. You can rely on it to update your importers, for when it will be officially available. A World contains multiple levels, and it has its own layout settings.
Enums§
- Allowed
Refs - Possible values:
Any
,OnlySame
,OnlyTags
,OnlySpecificEntity
- BgPos
- Checker
- Checker mode Possible values:
None
,Horizontal
,Vertical
- Editor
Display Mode - Possible values:
Hidden
,ValueOnly
,NameAndValue
,EntityTile
,LevelTile
,Points
,PointStar
,PointPath
,PointPathLoop
,RadiusPx
,RadiusGrid
,ArrayCountWithLabel
,ArrayCountNoLabel
,RefLinkBetweenPivots
,RefLinkBetweenCenters
- Editor
Display Pos - Possible values:
Above
,Center
,Beneath
- Editor
Link Style - Possible values:
ZigZag
,StraightArrow
,CurvedArrow
,ArrowsLine
,DashedLine
- Embed
Atlas - Field
Value - The actual value of a field instance on a Level or EntityInstance.
- Flag
- Identifier
Style - Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible
values:
Capitalize
,Uppercase
,Lowercase
,Free
- Image
Export Mode - “Image export” option when saving project. Possible values:
None
,OneImagePerLayer
,OneImagePerLevel
,LayersAndLevels
- Limit
Behavior - Possible values:
DiscardOldOnes
,PreventAdding
,MoveLastOne
- Limit
Scope - If TRUE, the maxCount is a “per world” limit, if FALSE, it’s a “per level”. Possible
values:
PerLayer
,PerLevel
,PerWorld
- Render
Mode - Possible values:
Rectangle
,Ellipse
,Tile
,Cross
- Text
Language Mode - Tile
Mode - Defines how tileIds array is used Possible values:
Single
,Stamp
- Tile
Render Mode - An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible
values:
Cover
,FitInside
,Repeat
,Stretch
,FullSizeCropped
,FullSizeUncropped
,NineSlice
- Type
- Type of the layer as Haxe Enum Possible values:
IntGrid
,Entities
,Tiles
,AutoLayer
- When
- Possible values:
Manual
,AfterLoad
,BeforeSave
,AfterSave
- World
Layout