1
use serde :: { Deserialize , Serialize } ; use std :: collections :: HashMap ; use serde_json :: Value ; # [doc = r" Whether or not the tile is flipped on the x and/or y axes."] # [derive (Debug , Clone , Eq , PartialEq)] pub struct TileFlip { pub x : bool , pub y : bool , } impl < 'de > Deserialize < 'de > for TileFlip { fn deserialize < D > (deserializer : D) -> Result < Self , D :: Error > where D : serde :: de :: Deserializer < 'de > , { let bits : i32 = Deserialize :: deserialize (deserializer) ? ; let x_bit = 0b01 ; let y_bit = 0b10 ; let mut flip = Self { x : false , y : false } ; if bits & x_bit != 0 { flip . x = true ; } if bits & y_bit != 0 { flip . y = true ; } Ok (flip) } } impl Serialize for TileFlip { fn serialize < S > (& self , serializer : S) -> Result < S :: Ok , S :: Error > where S : serde :: ser :: Serializer , { let mut flip_bits = 0 ; let x_bit = 0b01 ; let y_bit = 0b10 ; if self . x { flip_bits = flip_bits | x_bit ; } if self . y { flip_bits = flip_bits | y_bit ; } serializer . serialize_i32 (flip_bits) } } # [doc = ""] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct EntityInstance { # [doc = "Grid-based coordinates (`[x,y]` format)"] # [serde (rename = "__grid")] pub r#__grid : Vec < i32 > , # [doc = "Entity height in pixels. For non-resizable entities, it will be the same as Entity definition."] # [serde (rename = "height")] pub r#height : i32 , # [doc = "An array of all custom fields and their values."] # [serde (rename = "fieldInstances")] pub r#field_instances : Vec < FieldInstance > , # [doc = "Optional Tile used to display this entity (it could either be the default Entity tile, or some tile provided by a field value, like an Enum)."] # [serde (rename = "__tile")] pub r#__tile : Option < Value > , # [doc = "Entity definition identifier"] # [serde (rename = "__identifier")] pub r#__identifier : String , # [doc = "Pivot coordinates  (`[x,y]` format, values are from 0 to 1) of the Entity"] # [serde (rename = "__pivot")] pub r#__pivot : Vec < f32 > , # [doc = "Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget optional layer offsets, if they exist!"] # [serde (rename = "px")] pub r#px : Vec < i32 > , # [doc = "Entity width in pixels. For non-resizable entities, it will be the same as Entity definition."] # [serde (rename = "width")] pub r#width : i32 , # [doc = "Reference of the **Entity definition** UID"] # [serde (rename = "defUid")] pub r#def_uid : i32 } # [doc = ""] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct EntityDef { # [doc = ""] # [serde (rename = "lineOpacity")] pub r#line_opacity : f32 , # [doc = "Pixel height"] # [serde (rename = "height")] pub r#height : i32 , # [doc = "Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross`"] # [serde (rename = "renderMode")] pub r#render_mode : Value , # [doc = "Pixel width"] # [serde (rename = "width")] pub r#width : i32 , # [doc = ""] # [serde (rename = "hollow")] pub r#hollow : bool , # [doc = "Array of field definitions"] # [serde (rename = "fieldDefs")] pub r#field_defs : Vec < FieldDef > , # [doc = "If TRUE, the entity instances will be resizable horizontally"] # [serde (rename = "resizableX")] pub r#resizable_x : bool , # [doc = "Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne`"] # [serde (rename = "limitBehavior")] pub r#limit_behavior : Value , # [doc = "Pivot X coordinate (from 0 to 1.0)"] # [serde (rename = "pivotX")] pub r#pivot_x : f32 , # [doc = "Unique String identifier"] # [serde (rename = "identifier")] pub r#identifier : String , # [doc = "Tile ID used for optional tile display"] # [serde (rename = "tileId")] pub r#tile_id : Option < i32 > , # [doc = "An array of strings that classifies this entity"] # [serde (rename = "tags")] pub r#tags : Vec < String > , # [doc = "Possible values: `Cover`, `FitInside`, `Repeat`, `Stretch`"] # [serde (rename = "tileRenderMode")] pub r#tile_render_mode : Value , # [doc = "If TRUE, the entity instances will be resizable vertically"] # [serde (rename = "resizableY")] pub r#resizable_y : bool , # [doc = "Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height will keep the same aspect ratio as the definition."] # [serde (rename = "keepAspectRatio")] pub r#keep_aspect_ratio : bool , # [doc = "Display entity name in editor"] # [serde (rename = "showName")] pub r#show_name : bool , # [doc = "Unique Int identifier"] # [serde (rename = "uid")] pub r#uid : i32 , # [doc = ""] # [serde (rename = "fillOpacity")] pub r#fill_opacity : f32 , # [doc = "Tileset ID used for optional tile display"] # [serde (rename = "tilesetId")] pub r#tileset_id : Option < i32 > , # [doc = "Base entity color"] # [serde (rename = "color")] pub r#color : String , # [doc = "Pivot Y coordinate (from 0 to 1.0)"] # [serde (rename = "pivotY")] pub r#pivot_y : f32 , # [doc = "Max instances count"] # [serde (rename = "maxCount")] pub r#max_count : i32 , # [doc = "If TRUE, the maxCount is a \"per world\" limit, if FALSE, it's a \"per level\". Possible values: `PerLayer`, `PerLevel`, `PerWorld`"] # [serde (rename = "limitScope")] pub r#limit_scope : Value } # [doc = "Tile data in an Entity instance"] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct EntityInstanceTile { # [doc = "Tileset ID"] # [serde (rename = "tilesetUid")] pub r#tileset_uid : i32 , # [doc = "An array of 4 Int values that refers to the tile in the tileset image: `[ x, y, width, height ]`"] # [serde (rename = "srcRect")] pub r#src_rect : Vec < i32 > } # [doc = ""] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct FieldInstance { # [doc = "Type of the field, such as `Int`, `Float`, `Enum(my_enum_name)`, `Bool`, etc."] # [serde (rename = "__type")] pub r#__type : String , # [doc = "Reference of the **Field definition** UID"] # [serde (rename = "defUid")] pub r#def_uid : i32 , # [doc = "Field definition identifier"] # [serde (rename = "__identifier")] pub r#__identifier : String , # [doc = "Actual value of the field instance. The value type may vary, depending on `__type` (Integer, Boolean, String etc.)<br/>  It can also be an `Array` of those same types."] # [serde (rename = "__value")] pub r#__value : Value , # [doc = "Editor internal raw values"] # [serde (rename = "realEditorValues")] pub r#real_editor_values : Vec < Value > } # [doc = "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."] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct AutoRuleDef { # [doc = "X pivot of a tile stamp (0-1)"] # [serde (rename = "pivotX")] pub r#pivot_x : f32 , # [doc = "Defines how tileIds array is used Possible values: `Single`, `Stamp`"] # [serde (rename = "tileMode")] pub r#tile_mode : Value , # [doc = "If TRUE, enable Perlin filtering to only apply rule on specific random area"] # [serde (rename = "perlinActive")] pub r#perlin_active : bool , # [doc = "If TRUE, allow rule to be matched by flipping its pattern horizontally"] # [serde (rename = "flipX")] pub r#flip_x : bool , # [doc = "Checker mode Possible values: `None`, `Horizontal`, `Vertical`"] # [serde (rename = "checker")] pub r#checker : Value , # [doc = "Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value."] # [serde (rename = "tileIds")] pub r#tile_ids : Vec < i32 > , # [doc = "Pattern width & height. Should only be 1,3,5 or 7."] # [serde (rename = "size")] pub r#size : i32 , # [doc = "Chances for this rule to be applied (0 to 1)"] # [serde (rename = "chance")] pub r#chance : f32 , # [doc = "Y pivot of a tile stamp (0-1)"] # [serde (rename = "pivotY")] pub r#pivot_y : f32 , # [doc = ""] # [serde (rename = "perlinScale")] pub r#perlin_scale : f32 , # [doc = "Rule pattern (size x size)"] # [serde (rename = "pattern")] pub r#pattern : Vec < i32 > , # [doc = "When TRUE, the rule will prevent other rules to be applied in the same cell if it matches (TRUE by default)."] # [serde (rename = "breakOnMatch")] pub r#break_on_match : bool , # [doc = ""] # [serde (rename = "perlinOctaves")] pub r#perlin_octaves : f32 , # [doc = "Unique Int identifier"] # [serde (rename = "uid")] pub r#uid : i32 , # [doc = "If FALSE, the rule effect isn't applied, and no tiles are generated."] # [serde (rename = "active")] pub r#active : bool , # [doc = ""] # [serde (rename = "perlinSeed")] pub r#perlin_seed : f32 , # [doc = "If TRUE, allow rule to be matched by flipping its pattern vertically"] # [serde (rename = "flipY")] pub r#flip_y : bool , # [doc = "Y cell coord modulo"] # [serde (rename = "yModulo")] pub r#y_modulo : i32 , # [doc = "X cell coord modulo"] # [serde (rename = "xModulo")] pub r#x_modulo : i32 } # [doc = "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."] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct TilesetDef { # [doc = "Image height in pixels"] # [serde (rename = "pxHei")] pub r#px_hei : i32 , # [doc = "Path to the source file, relative to the current project JSON file"] # [serde (rename = "relPath")] pub r#rel_path : String , # [doc = ""] # [serde (rename = "tileGridSize")] pub r#tile_grid_size : i32 , # [doc = "Distance in pixels from image borders"] # [serde (rename = "padding")] pub r#padding : i32 , # [doc = "Space in pixels between all tiles"] # [serde (rename = "spacing")] pub r#spacing : i32 , # [doc = "The following data is used internally for various optimizations. It's always synced with source image changes."] # [serde (rename = "cachedPixelData")] pub r#cached_pixel_data : Option < HashMap < String , Value > > , # [doc = "Array of group of tiles selections, only meant to be used in the editor"] # [serde (rename = "savedSelections")] pub r#saved_selections : Vec < HashMap < String , Value > > , # [doc = "Unique String identifier"] # [serde (rename = "identifier")] pub r#identifier : String , # [doc = "Image width in pixels"] # [serde (rename = "pxWid")] pub r#px_wid : i32 , # [doc = "Unique Intidentifier"] # [serde (rename = "uid")] pub r#uid : i32 } # [doc = "This structure represents a single tile from a given Tileset."] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct Tile { # [doc = "\"Flip bits\", a 2-bits integer to represent the mirror transformations of the tile.<br/>   - Bit 0 = X flip<br/>   - Bit 1 = Y flip<br/>   Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips)"] # [serde (rename = "f")] pub r#f : TileFlip , # [doc = "Internal data used by the editor.<br/>  For auto-layer tiles: `[ruleId, coordId]`.<br/>  For tile-layer tiles: `[coordId]`."] # [serde (rename = "d")] pub r#d : Vec < i32 > , # [doc = "Pixel coordinates of the tile in the **tileset** (`[x,y]` format)"] # [serde (rename = "src")] pub r#src : Vec < i32 > , # [doc = "The *Tile ID* in the corresponding tileset."] # [serde (rename = "t")] pub r#t : i32 , # [doc = "Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional layer offsets, if they exist!"] # [serde (rename = "px")] pub r#px : Vec < i32 > } # [doc = ""] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct LayerInstance { # [doc = ""] # [serde (rename = "entityInstances")] pub r#entity_instances : Vec < EntityInstance > , # [doc = "Grid-based width"] # [serde (rename = "__cWid")] pub r#__c_wid : i32 , # [doc = "Total layer X pixel offset, including both instance and definition offsets."] # [serde (rename = "__pxTotalOffsetX")] pub r#__px_total_offset_x : i32 , # [doc = "The definition UID of corresponding Tileset, if any."] # [serde (rename = "__tilesetDefUid")] pub r#__tileset_def_uid : Option < i32 > , # [doc = "**WARNING**: this deprecated value will be *removed* completely on version 0.9.0+  Replaced by: `intGridCsv`"] # [serde (rename = "intGrid")] pub r#int_grid : Option < Vec < IntGridValueInstance > > , # [doc = ""] # [serde (rename = "gridTiles")] pub r#grid_tiles : Vec < Tile > , # [doc = "This layer can use another tileset by overriding the tileset UID here."] # [serde (rename = "overrideTilesetUid")] pub r#override_tileset_uid : Option < i32 > , # [doc = "Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer)"] # [serde (rename = "__type")] pub r#__type : String , # [doc = "Grid-based height"] # [serde (rename = "__cHei")] pub r#__c_hei : i32 , # [doc = "Reference the Layer definition UID"] # [serde (rename = "layerDefUid")] pub r#layer_def_uid : i32 , # [doc = "Layer instance visibility"] # [serde (rename = "visible")] pub r#visible : bool , # [doc = "Reference to the UID of the level containing this layer instance"] # [serde (rename = "levelId")] pub r#level_id : i32 , # [doc = "Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, see `__pxTotalOffsetY`)"] # [serde (rename = "pxOffsetY")] pub r#px_offset_y : i32 , # [doc = "Random seed used for Auto-Layers rendering"] # [serde (rename = "seed")] pub r#seed : i32 , # [doc = "Layer definition identifier"] # [serde (rename = "__identifier")] pub r#__identifier : String , # [doc = "Total layer Y pixel offset, including both instance and definition offsets."] # [serde (rename = "__pxTotalOffsetY")] pub r#__px_total_offset_y : i32 , # [doc = "Grid size"] # [serde (rename = "__gridSize")] pub r#__grid_size : i32 , # [doc = "An array containing all tiles generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).<br/><br/>  Note: if multiple tiles are stacked in the same cell as the result of different rules, all tiles behind opaque ones will be discarded."] # [serde (rename = "autoLayerTiles")] pub r#auto_layer_tiles : Vec < Tile > , # [doc = "X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, see `__pxTotalOffsetX`)"] # [serde (rename = "pxOffsetX")] pub r#px_offset_x : i32 , # [doc = "The relative path to corresponding Tileset, if any."] # [serde (rename = "__tilesetRelPath")] pub r#__tileset_rel_path : Option < String > , # [doc = "A list of all values in the IntGrid layer, stored from left to right, and top to bottom (ie. first row from left to right, followed by second row, etc). `0` means \"empty cell\" and IntGrid values start at 1. This array size is `__cWid` x `__cHei` cells."] # [serde (rename = "intGridCsv")] pub r#int_grid_csv : Vec < i32 > , # [doc = "Layer opacity as Float [0-1]"] # [serde (rename = "__opacity")] pub r#__opacity : f32 } # [doc = "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."] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct Level { # [doc = "An array containing this level custom field values."] # [serde (rename = "fieldInstances")] pub r#field_instances : Vec < FieldInstance > , # [doc = "An array listing all other levels touching this one on the world map. In \"linear\" world layouts, this array is populated with previous/next levels in array, and `dir` depends on the linear horizontal/vertical layout."] # [serde (rename = "__neighbours")] pub r#__neighbours : Vec < NeighbourLevel > , # [doc = "Background image Y pivot (0-1)"] # [serde (rename = "bgPivotY")] pub r#bg_pivot_y : f32 , # [doc = "Height of the level in pixels"] # [serde (rename = "pxHei")] pub r#px_hei : i32 , # [doc = "An enum defining the way the background image (if any) is positioned on the level. See `__bgPos` for resulting position info. Possible values: &lt;`null`&gt;, `Unscaled`, `Contain`, `Cover`, `CoverDirty`"] # [serde (rename = "bgPos")] pub r#bg_pos : Option < Value > , # [doc = "World Y coordinate in pixels"] # [serde (rename = "worldY")] pub r#world_y : i32 , # [doc = "Background image X pivot (0-1)"] # [serde (rename = "bgPivotX")] pub r#bg_pivot_x : f32 , # [doc = "World X coordinate in pixels"] # [serde (rename = "worldX")] pub r#world_x : i32 , # [doc = "This value is not null if the project option \"*Save levels separately*\" is enabled. In this case, this **relative** path points to the level Json file."] # [serde (rename = "externalRelPath")] pub r#external_rel_path : Option < String > , # [doc = "An array containing all Layer instances. **IMPORTANT**: if the project option \"*Save levels separately*\" is enabled, this field will be `null`.<br/>  This array is **sorted in display order**: the 1st layer is the top-most and the last is behind."] # [serde (rename = "layerInstances")] pub r#layer_instances : Option < Vec < LayerInstance > > , # [doc = "Background color of the level (same as `bgColor`, except the default value is automatically used here if its value is `null`)"] # [serde (rename = "__bgColor")] pub r#__bg_color : String , # [doc = "The *optional* relative path to the level background image."] # [serde (rename = "bgRelPath")] pub r#bg_rel_path : Option < String > , # [doc = "Background color of the level. If `null`, the project `defaultLevelBgColor` should be used."] # [serde (rename = "bgColor")] pub r#bg_color : Option < String > , # [doc = "Unique String identifier"] # [serde (rename = "identifier")] pub r#identifier : String , # [doc = "Width of the level in pixels"] # [serde (rename = "pxWid")] pub r#px_wid : i32 , # [doc = "Position informations of the background image, if there is one."] # [serde (rename = "__bgPos")] pub r#__bg_pos : Option < Value > , # [doc = "Unique Int identifier"] # [serde (rename = "uid")] pub r#uid : i32 } # [doc = "IntGrid value definition"] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct IntGridValueDef { # [doc = ""] # [serde (rename = "color")] pub r#color : String , # [doc = "The IntGrid value itself"] # [serde (rename = "value")] pub r#value : i32 , # [doc = "Unique String identifier"] # [serde (rename = "identifier")] pub r#identifier : Option < String > } # [doc = "This section is mostly only intended for the LDtk editor app itself. You can safely ignore it."] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct FieldDef { # [doc = "Human readable value type (eg. `Int`, `Float`, `Point`, etc.). If the field is an array, this field will look like `Array<...>` (eg. `Array<Int>`, `Array<Point>` etc.)"] # [serde (rename = "__type")] pub r#__type : String , # [doc = "Min limit for value, if applicable"] # [serde (rename = "min")] pub r#min : Option < f32 > , # [doc = "Unique Intidentifier"] # [serde (rename = "uid")] pub r#uid : i32 , # [doc = ""] # [serde (rename = "editorCutLongValues")] pub r#editor_cut_long_values : bool , # [doc = "Array max length"] # [serde (rename = "arrayMaxLength")] pub r#array_max_length : Option < i32 > , # [doc = "Possible values: `Above`, `Center`, `Beneath`"] # [serde (rename = "editorDisplayPos")] pub r#editor_display_pos : Value , # [doc = "Default value if selected value is null or invalid."] # [serde (rename = "defaultOverride")] pub r#default_override : Option < Value > , # [doc = "Optional list of accepted file extensions for FilePath value type. Includes the dot: `.ext`"] # [serde (rename = "acceptFileTypes")] pub r#accept_file_types : Option < Vec < String > > , # [doc = "Array min length"] # [serde (rename = "arrayMinLength")] pub r#array_min_length : Option < i32 > , # [doc = "TRUE if the value is an array of multiple values"] # [serde (rename = "isArray")] pub r#is_array : bool , # [doc = "Unique String identifier"] # [serde (rename = "identifier")] pub r#identifier : String , # [doc = "Optional regular expression that needs to be matched to accept values. Expected format: `/some_reg_ex/g`, with optional \"i\" flag."] # [serde (rename = "regex")] pub r#regex : Option < String > , # [doc = "Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `PointStar`, `PointPath`, `RadiusPx`, `RadiusGrid`"] # [serde (rename = "editorDisplayMode")] pub r#editor_display_mode : Value , # [doc = "Max limit for value, if applicable"] # [serde (rename = "max")] pub r#max : Option < f32 > , # [doc = "Possible values: &lt;`null`&gt;, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`"] # [serde (rename = "textLangageMode")] pub r#text_langage_mode : Option < Value > , # [doc = "TRUE if the value can be null. For arrays, TRUE means it can contain null values (exception: array of Points can't have null values)."] # [serde (rename = "canBeNull")] pub r#can_be_null : bool , # [doc = ""] # [serde (rename = "editorAlwaysShow")] pub r#editor_always_show : bool , # [doc = "Internal type enum"] # [serde (rename = "type")] pub r#field_def_type : Value } # [doc = "Level background image position info"] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct LevelBgPosInfos { # [doc = "An array containing the `[scaleX,scaleY]` values of the **cropped** background image, depending on `bgPos` option."] # [serde (rename = "scale")] pub r#scale : Vec < f32 > , # [doc = "An array of 4 float values describing the cropped sub-rectangle of the displayed background image. This cropping happens when original is larger than the level bounds. Array format: `[ cropX, cropY, cropWidth, cropHeight ]`"] # [serde (rename = "cropRect")] pub r#crop_rect : Vec < f32 > , # [doc = "An array containing the `[x,y]` pixel coordinates of the top-left corner of the **cropped** background image, depending on `bgPos` option."] # [serde (rename = "topLeftPx")] pub r#top_left_px : Vec < i32 > } # [doc = ""] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct EnumDefValues { # [doc = "The optional ID of the tile"] # [serde (rename = "tileId")] pub r#tile_id : Option < i32 > , # [doc = "An array of 4 Int values that refers to the tile in the tileset image: `[ x, y, width, height ]`"] # [serde (rename = "__tileSrcRect")] pub r#__tile_src_rect : Option < Vec < i32 > > , # [doc = "Enum value"] # [serde (rename = "id")] pub r#id : String } # [doc = "Nearby level info"] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct NeighbourLevel { # [doc = "A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, `e`ast)."] # [serde (rename = "dir")] pub r#dir : String , # [doc = ""] # [serde (rename = "levelUid")] pub r#level_uid : i32 } # [doc = "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 the `defs` 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**."] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct Definitions { # [doc = "An array containing all custom fields available to all levels."] # [serde (rename = "levelFields")] pub r#level_fields : Vec < FieldDef > , # [doc = ""] # [serde (rename = "tilesets")] pub r#tilesets : Vec < TilesetDef > , # [doc = ""] # [serde (rename = "layers")] pub r#layers : Vec < LayerDef > , # [doc = "Note: external enums are exactly the same as `enums`, except they have a `relPath` to point to an external source file."] # [serde (rename = "externalEnums")] pub r#external_enums : Vec < EnumDef > , # [doc = ""] # [serde (rename = "enums")] pub r#enums : Vec < EnumDef > , # [doc = "All entities, including their custom fields"] # [serde (rename = "entities")] pub r#entities : Vec < EntityDef > } # [doc = "IntGrid value instance"] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct IntGridValueInstance { # [doc = "Coordinate ID in the layer grid"] # [serde (rename = "coordId")] pub r#coord_id : i32 , # [doc = "IntGrid value"] # [serde (rename = "v")] pub r#v : i32 } # [doc = ""] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct LayerDef { # [doc = "If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell."] # [serde (rename = "tilePivotX")] pub r#tile_pivot_x : f32 , # [doc = "Unique Int identifier"] # [serde (rename = "uid")] pub r#uid : i32 , # [doc = "X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset)"] # [serde (rename = "pxOffsetX")] pub r#px_offset_x : i32 , # [doc = "If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell."] # [serde (rename = "tilePivotY")] pub r#tile_pivot_y : f32 , # [doc = "Reference to the Tileset UID being used by this auto-layer rules"] # [serde (rename = "autoTilesetDefUid")] pub r#auto_tileset_def_uid : Option < i32 > , # [doc = "An array of tags to filter Entities that can be added to this layer"] # [serde (rename = "requiredTags")] pub r#required_tags : Vec < String > , # [doc = "Reference to the Tileset UID being used by this Tile layer"] # [serde (rename = "tilesetDefUid")] pub r#tileset_def_uid : Option < i32 > , # [doc = "Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*)"] # [serde (rename = "__type")] pub r#__type : String , # [doc = "An array of tags to forbid some Entities in this layer"] # [serde (rename = "excludedTags")] pub r#excluded_tags : Vec < String > , # [doc = "An array that defines extra optional info for each IntGrid value. The array is sorted using value (ascending)."] # [serde (rename = "intGridValues")] pub r#int_grid_values : Vec < IntGridValueDef > , # [doc = "Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, `AutoLayer`"] # [serde (rename = "type")] pub r#layer_def_type : Value , # [doc = "Contains all the auto-layer rule definitions."] # [serde (rename = "autoRuleGroups")] pub r#auto_rule_groups : Vec < HashMap < String , Value > > , # [doc = "Width and height of the grid in pixels"] # [serde (rename = "gridSize")] pub r#grid_size : i32 , # [doc = ""] # [serde (rename = "autoSourceLayerDefUid")] pub r#auto_source_layer_def_uid : Option < i32 > , # [doc = "Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset)"] # [serde (rename = "pxOffsetY")] pub r#px_offset_y : i32 , # [doc = "Opacity of the layer (0 to 1.0)"] # [serde (rename = "displayOpacity")] pub r#display_opacity : f32 , # [doc = "Unique String identifier"] # [serde (rename = "identifier")] pub r#identifier : String } # [doc = ""] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct EnumDef { # [doc = ""] # [serde (rename = "externalFileChecksum")] pub r#external_file_checksum : Option < String > , # [doc = "Unique Int identifier"] # [serde (rename = "uid")] pub r#uid : i32 , # [doc = "All possible enum values, with their optional Tile infos."] # [serde (rename = "values")] pub r#values : Vec < EnumDefValues > , # [doc = "Unique String identifier"] # [serde (rename = "identifier")] pub r#identifier : String , # [doc = "Tileset UID if provided"] # [serde (rename = "iconTilesetUid")] pub r#icon_tileset_uid : Option < i32 > , # [doc = "Relative path to the external file providing this Enum"] # [serde (rename = "externalRelPath")] pub r#external_rel_path : Option < String > } # [doc = "This is the root of any Project JSON file. It contains:  - the project settings, - an array of levels, - and a definition object (that can probably be safely ignored for most users)."] # [derive (Clone , Debug , Serialize , Deserialize)] pub struct Project { # [doc = "If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file (default is FALSE)"] # [serde (rename = "exportTiled")] pub r#export_tiled : bool , # [doc = "An enum that describes how levels are organized in this project (ie. linearly or in a 2D space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`"] # [serde (rename = "worldLayout")] pub r#world_layout : Value , # [doc = "Next Unique integer ID available"] # [serde (rename = "nextUid")] pub r#next_uid : i32 , # [doc = "If TRUE, one file will be saved for the project (incl. all its definitions) and one file in a sub-folder for each level."] # [serde (rename = "externalLevels")] pub r#external_levels : bool , # [doc = "Default X pivot (0 to 1) for new entities"] # [serde (rename = "defaultPivotX")] pub r#default_pivot_x : f32 , # [doc = "If TRUE, an extra copy of the project will be created in a sub folder, when saving."] # [serde (rename = "backupOnSave")] pub r#backup_on_save : bool , # [doc = "File naming pattern for exported PNGs"] # [serde (rename = "pngFilePattern")] pub r#png_file_pattern : Option < String > , # [doc = "Width of the world grid in pixels."] # [serde (rename = "worldGridWidth")] pub r#world_grid_width : i32 , # [doc = "Number of backup files to keep, if the `backupOnSave` is TRUE"] # [serde (rename = "backupLimit")] pub r#backup_limit : i32 , # [doc = "A structure containing all the definitions of this project"] # [serde (rename = "defs")] pub r#defs : Definitions , # [doc = "Default new level height"] # [serde (rename = "defaultLevelHeight")] pub r#default_level_height : i32 , # [doc = "Default new level width"] # [serde (rename = "defaultLevelWidth")] pub r#default_level_width : i32 , # [doc = "Default grid size for new layers"] # [serde (rename = "defaultGridSize")] pub r#default_grid_size : i32 , # [doc = "If TRUE, all layers in all levels will also be exported as PNG along with the project file (default is FALSE)"] # [serde (rename = "exportPng")] pub r#export_png : bool , # [doc = "If TRUE, the Json is partially minified (no indentation, nor line breaks, default is FALSE)"] # [serde (rename = "minifyJson")] pub r#minify_json : bool , # [doc = "Default background color of levels"] # [serde (rename = "defaultLevelBgColor")] pub r#default_level_bg_color : String , # [doc = "File format version"] # [serde (rename = "jsonVersion")] pub r#json_version : String , # [doc = "An array containing various advanced flags (ie. options or other states). Possible values: `DiscardPreCsvIntGrid`, `IgnoreBackupSuggest`"] # [serde (rename = "flags")] pub r#flags : Vec < Value > , # [doc = "Height of the world grid in pixels."] # [serde (rename = "worldGridHeight")] pub r#world_grid_height : i32 , # [doc = "Project background color"] # [serde (rename = "bgColor")] pub r#bg_color : String , # [doc = "Default Y pivot (0 to 1) for new entities"] # [serde (rename = "defaultPivotY")] pub r#default_pivot_y : f32 , # [doc = "All levels. The order of this array is only relevant in `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level."] # [serde (rename = "levels")] pub r#levels : Vec < Level > }