A library for parsing Tiled maps.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add properties

+1939 -722
+14 -5
src/Map.zig
··· 7 7 8 8 layers_by_name: std.StringHashMapUnmanaged(Layer), 9 9 layers: std.ArrayList(Layer), 10 + properties: std.StringHashMapUnmanaged(Property), 10 11 tilesets: std.ArrayList(Tileset), 11 12 12 13 background_color: ?Color = null, ··· 36 37 .tilesets = .empty, 37 38 .layers_by_name = .empty, 38 39 .layers = .empty, 40 + .properties = .empty, 39 41 }; 40 42 41 43 if (json_map.tilesets) |json_tilesets| { ··· 53 55 } 54 56 } 55 57 58 + if (json_map.properties) |properties| { 59 + for (properties) |property| { 60 + const prop = try Property.fromJson(alloc, property); 61 + try map.properties.put(alloc, prop.name, prop); 62 + } 63 + } 64 + 56 65 return map; 57 66 } 58 67 ··· 88 97 } 89 98 self.tilesets.deinit(allocator); 90 99 91 - // var properties_it = self.properties.valueIterator(); 92 - // while (properties_it.next()) |value_ptr| { 93 - // value_ptr.*.deinit(allocator); 94 - // } 95 - // self.properties.deinit(allocator); 100 + var properties_it = self.properties.valueIterator(); 101 + while (properties_it.next()) |value_ptr| { 102 + value_ptr.*.deinit(allocator); 103 + } 104 + self.properties.deinit(allocator); 96 105 } 97 106 98 107 pub fn getTile(self: Map, gid: u32) ?Tile {
+34 -1
src/layer.zig
··· 4 4 content: LayerContent, 5 5 visible: bool, 6 6 class: ?[]const u8 = null, 7 + properties: std.StringHashMapUnmanaged(Property), 7 8 8 9 pub fn fromJson(allocator: Allocator, json_layer: JsonLayer) !Layer { 10 + var properties: std.StringHashMapUnmanaged(Property) = .empty; 11 + 12 + if (json_layer.properties) |props| { 13 + for (props) |property| { 14 + const prop = try Property.fromJson(allocator, property); 15 + try properties.put(allocator, prop.name, prop); 16 + } 17 + } 18 + 9 19 return .{ 10 20 .class = if (json_layer.class) |class| try allocator.dupe(u8, class) else null, 11 21 .id = json_layer.id, 12 22 .name = try allocator.dupe(u8, json_layer.name), 13 23 .visible = json_layer.visible, 14 24 .content = try LayerContent.fromJson(allocator, json_layer), 25 + .properties = properties, 15 26 }; 16 27 } 17 28 ··· 19 30 if (self.class) |class| allocator.free(class); 20 31 allocator.free(self.name); 21 32 self.content.deinit(allocator); 33 + 34 + var properties_it = self.properties.valueIterator(); 35 + while (properties_it.next()) |value_ptr| { 36 + value_ptr.*.deinit(allocator); 37 + } 38 + self.properties.deinit(allocator); 22 39 } 23 40 24 41 /// https://doc.mapeditor.org/en/stable/reference/jsonk-map-format/#layer ··· 349 366 point: ?bool = null, 350 367 polygon: ?[]Point = null, 351 368 polyline: ?[]Point = null, 352 - properties: ?[]Property = null, 369 + properties: std.StringHashMapUnmanaged(Property), 353 370 rotation: f32, 354 371 template: ?[]const u8 = null, 355 372 text: ?Text = null, ··· 371 388 }; 372 389 373 390 pub fn fromJson(allocator: Allocator, json_object: JsonObject) !Object { 391 + var properties: std.StringHashMapUnmanaged(Property) = .empty; 392 + 393 + if (json_object.properties) |props| { 394 + for (props) |property| { 395 + const prop = try Property.fromJson(allocator, property); 396 + try properties.put(allocator, prop.name, prop); 397 + } 398 + } 399 + 374 400 const object: Object = .{ 375 401 .gid = json_object.gid, 376 402 .height = json_object.height, ··· 383 409 .width = json_object.width, 384 410 .x = json_object.x, 385 411 .y = json_object.y, 412 + .properties = properties, 386 413 387 414 .type = set_type: { 388 415 if (json_object.gid) |_| { ··· 409 436 pub fn deinit(self: *Object, allocator: Allocator) void { 410 437 allocator.free(self.name); 411 438 if (self.class) |class| allocator.free(class); 439 + 440 + var properties_it = self.properties.valueIterator(); 441 + while (properties_it.next()) |value_ptr| { 442 + value_ptr.*.deinit(allocator); 443 + } 444 + self.properties.deinit(allocator); 412 445 } 413 446 414 447 const JsonObject = struct {
+95 -86
test/map-base64-gzip.tmj
··· 1 1 { 2 - "backgroundcolor":"#aabbccdd", 3 - "class":"bar", 4 - "compressionlevel":-1, 5 - "height":30, 6 - "infinite":false, 7 - "layers":[ 2 + "backgroundcolor": "#aabbccdd", 3 + "class": "bar", 4 + "compressionlevel": -1, 5 + "height": 30, 6 + "infinite": false, 7 + "layers": [ 8 + { 9 + "class": "bar", 10 + "compression": "gzip", 11 + "data": "H4sIAAAAAAAAA+3BAQEAAAABIP6fNkTVAAAA8Gh8W1o2EA4AAA==", 12 + "encoding": "base64", 13 + "height": 30, 14 + "id": 1, 15 + "name": "Tile Layer 1", 16 + "opacity": 1, 17 + "type": "tilelayer", 18 + "visible": true, 19 + "width": 30, 20 + "x": 0, 21 + "y": 0 22 + }, 23 + { 24 + "draworder": "topdown", 25 + "id": 2, 26 + "name": "Object Layer 1", 27 + "objects": [ 8 28 { 9 - "class":"bar", 10 - "compression":"gzip", 11 - "data":"H4sIAAAAAAAAA+3BAQEAAAABIP6fNkTVAAAA8Gh8W1o2EA4AAA==", 12 - "encoding":"base64", 13 - "height":30, 14 - "id":1, 15 - "name":"Tile Layer 1", 16 - "opacity":1, 17 - "type":"tilelayer", 18 - "visible":true, 19 - "width":30, 20 - "x":0, 21 - "y":0 22 - }, 29 + "height": 19, 30 + "id": 1, 31 + "name": "hello", 32 + "rotation": 0, 33 + "text": { 34 + "text": "Hello World", 35 + "wrap": true 36 + }, 37 + "type": "hello_world", 38 + "visible": true, 39 + "width": 91.4375, 40 + "x": 70, 41 + "y": 44 42 + }, 23 43 { 24 - "draworder":"topdown", 25 - "id":2, 26 - "name":"Object Layer 1", 27 - "objects":[ 28 - { 29 - "height":19, 30 - "id":1, 31 - "name":"hello", 32 - "rotation":0, 33 - "text": 34 - { 35 - "text":"Hello World", 36 - "wrap":true 37 - }, 38 - "type":"hello_world", 39 - "visible":true, 40 - "width":91.4375, 41 - "x":70, 42 - "y":44 43 - }, 44 - { 45 - "height":84.2105263157895, 46 - "id":2, 47 - "name":"", 48 - "rotation":0, 49 - "type":"", 50 - "visible":true, 51 - "width":100.250626566416, 52 - "x":214.53634085213, 53 - "y":172.431077694236 54 - }], 55 - "opacity":1, 56 - "type":"objectgroup", 57 - "visible":true, 58 - "x":0, 59 - "y":0 60 - }, 61 - { 62 - "id":3, 63 - "image":"", 64 - "name":"Image Layer 1", 65 - "opacity":1, 66 - "type":"imagelayer", 67 - "visible":true, 68 - "x":0, 69 - "y":0 70 - }], 71 - "nextlayerid":4, 72 - "nextobjectid":3, 73 - "orientation":"orthogonal", 74 - "renderorder":"right-down", 75 - "tiledversion":"1.11.2", 76 - "tileheight":16, 77 - "tilesets":[ 78 - { 79 - "firstgid":1, 80 - "source":"source_tileset.tsj" 81 - }, 82 - { 83 - "firstgid":5, 84 - "source":"images_tileset.tsj" 85 - }], 86 - "tilewidth":16, 87 - "type":"map", 88 - "version":"1.10", 89 - "width":30 44 + "height": 84.2105263157895, 45 + "id": 2, 46 + "name": "", 47 + "rotation": 0, 48 + "type": "", 49 + "visible": true, 50 + "width": 100.250626566416, 51 + "x": 214.53634085213, 52 + "y": 172.431077694236 53 + } 54 + ], 55 + "opacity": 1, 56 + "type": "objectgroup", 57 + "visible": true, 58 + "x": 0, 59 + "y": 0 60 + }, 61 + { 62 + "id": 3, 63 + "image": "", 64 + "name": "Image Layer 1", 65 + "opacity": 1, 66 + "type": "imagelayer", 67 + "visible": true, 68 + "x": 0, 69 + "y": 0 70 + } 71 + ], 72 + "nextlayerid": 4, 73 + "nextobjectid": 3, 74 + "orientation": "orthogonal", 75 + "renderorder": "right-down", 76 + "tiledversion": "1.11.2", 77 + "tileheight": 16, 78 + "tilesets": [ 79 + { 80 + "firstgid": 1, 81 + "source": "source_tileset.tsj" 82 + }, 83 + { 84 + "firstgid": 5, 85 + "source": "images_tileset.tsj" 86 + } 87 + ], 88 + "tilewidth": 16, 89 + "type": "map", 90 + "version": "1.10", 91 + "width": 30, 92 + "properties": [ 93 + { 94 + "name": "test_property", 95 + "type": "string", 96 + "value": "test_value" 97 + } 98 + ] 90 99 }
+100 -92
test/map-base64-none.tmj
··· 1 - { "backgroundcolor":"#aabbccdd", 2 - "class":"bar", 3 - "compressionlevel":-1, 4 - "editorsettings": 1 + { 2 + "backgroundcolor": "#aabbccdd", 3 + "class": "bar", 4 + "compressionlevel": -1, 5 + "editorsettings": { 6 + "export": { 7 + "format": "json", 8 + "target": "map-base64-zstd.tmj" 9 + } 10 + }, 11 + "height": 30, 12 + "infinite": false, 13 + "layers": [ 5 14 { 6 - "export": 7 - { 8 - "format":"json", 9 - "target":"map-base64-zstd.tmj" 10 - } 15 + "class": "bar", 16 + "compression": "zstd", 17 + "data": "KLUv/WAQDU0AABABAAEAC/YBFg==", 18 + "encoding": "base64", 19 + "height": 30, 20 + "id": 1, 21 + "name": "Tile Layer 1", 22 + "opacity": 1, 23 + "type": "tilelayer", 24 + "visible": true, 25 + "width": 30, 26 + "x": 0, 27 + "y": 0 11 28 }, 12 - "height":30, 13 - "infinite":false, 14 - "layers":[ 15 - { 16 - "class":"bar", 17 - "compression":"zstd", 18 - "data":"KLUv\/WAQDU0AABABAAEAC\/YBFg==", 19 - "encoding":"base64", 20 - "height":30, 21 - "id":1, 22 - "name":"Tile Layer 1", 23 - "opacity":1, 24 - "type":"tilelayer", 25 - "visible":true, 26 - "width":30, 27 - "x":0, 28 - "y":0 29 - }, 30 - { 31 - "draworder":"topdown", 32 - "id":2, 33 - "name":"Object Layer 1", 34 - "objects":[ 35 - { 36 - "height":19, 37 - "id":1, 38 - "name":"hello", 39 - "rotation":0, 40 - "text": 41 - { 42 - "text":"Hello World", 43 - "wrap":true 44 - }, 45 - "type":"hello_world", 46 - "visible":true, 47 - "width":91.4375, 48 - "x":70, 49 - "y":44 50 - }, 51 - { 52 - "height":84.2105263157895, 53 - "id":2, 54 - "name":"", 55 - "rotation":0, 56 - "type":"", 57 - "visible":true, 58 - "width":100.250626566416, 59 - "x":214.53634085213, 60 - "y":172.431077694236 61 - }], 62 - "opacity":1, 63 - "type":"objectgroup", 64 - "visible":true, 65 - "x":0, 66 - "y":0 67 - }, 68 - { 69 - "id":3, 70 - "image":"", 71 - "name":"Image Layer 1", 72 - "opacity":1, 73 - "type":"imagelayer", 74 - "visible":true, 75 - "x":0, 76 - "y":0 77 - }], 78 - "nextlayerid":4, 79 - "nextobjectid":3, 80 - "orientation":"orthogonal", 81 - "renderorder":"right-down", 82 - "tiledversion":"1.11.2", 83 - "tileheight":16, 84 - "tilesets":[ 29 + { 30 + "draworder": "topdown", 31 + "id": 2, 32 + "name": "Object Layer 1", 33 + "objects": [ 85 34 { 86 - "firstgid":1, 87 - "source":"source_tileset.tsj" 88 - }, 35 + "height": 19, 36 + "id": 1, 37 + "name": "hello", 38 + "rotation": 0, 39 + "text": { 40 + "text": "Hello World", 41 + "wrap": true 42 + }, 43 + "type": "hello_world", 44 + "visible": true, 45 + "width": 91.4375, 46 + "x": 70, 47 + "y": 44 48 + }, 89 49 { 90 - "firstgid":5, 91 - "source":"images_tileset.tsj" 92 - }], 93 - "tilewidth":16, 94 - "type":"map", 95 - "version":"1.10", 96 - "width":30 50 + "height": 84.2105263157895, 51 + "id": 2, 52 + "name": "", 53 + "rotation": 0, 54 + "type": "", 55 + "visible": true, 56 + "width": 100.250626566416, 57 + "x": 214.53634085213, 58 + "y": 172.431077694236 59 + } 60 + ], 61 + "opacity": 1, 62 + "type": "objectgroup", 63 + "visible": true, 64 + "x": 0, 65 + "y": 0 66 + }, 67 + { 68 + "id": 3, 69 + "image": "", 70 + "name": "Image Layer 1", 71 + "opacity": 1, 72 + "type": "imagelayer", 73 + "visible": true, 74 + "x": 0, 75 + "y": 0 76 + } 77 + ], 78 + "nextlayerid": 4, 79 + "nextobjectid": 3, 80 + "orientation": "orthogonal", 81 + "renderorder": "right-down", 82 + "tiledversion": "1.11.2", 83 + "tileheight": 16, 84 + "tilesets": [ 85 + { 86 + "firstgid": 1, 87 + "source": "source_tileset.tsj" 88 + }, 89 + { 90 + "firstgid": 5, 91 + "source": "images_tileset.tsj" 92 + } 93 + ], 94 + "tilewidth": 16, 95 + "type": "map", 96 + "version": "1.10", 97 + "width": 30, 98 + "properties": [ 99 + { 100 + "name": "test_property", 101 + "type": "string", 102 + "value": "test_value" 103 + } 104 + ] 97 105 }
+96 -86
test/map-base64-zlib.tmj
··· 1 - { "backgroundcolor":"#aabbccdd", 2 - "class":"bar", 3 - "compressionlevel":-1, 4 - "height":30, 5 - "infinite":false, 6 - "layers":[ 7 - { 8 - "class":"bar", 9 - "compression":"zlib", 10 - "data":"eJztwQEBAAAAASD+nzZE1QAAAPBoHCAAAg==", 11 - "encoding":"base64", 12 - "height":30, 13 - "id":1, 14 - "name":"Tile Layer 1", 15 - "opacity":1, 16 - "type":"tilelayer", 17 - "visible":true, 18 - "width":30, 19 - "x":0, 20 - "y":0 21 - }, 22 - { 23 - "draworder":"topdown", 24 - "id":2, 25 - "name":"Object Layer 1", 26 - "objects":[ 27 - { 28 - "height":19, 29 - "id":1, 30 - "name":"hello", 31 - "rotation":0, 32 - "text": 33 - { 34 - "text":"Hello World", 35 - "wrap":true 36 - }, 37 - "type":"hello_world", 38 - "visible":true, 39 - "width":91.4375, 40 - "x":70, 41 - "y":44 42 - }, 43 - { 44 - "height":84.2105263157895, 45 - "id":2, 46 - "name":"", 47 - "rotation":0, 48 - "type":"", 49 - "visible":true, 50 - "width":100.250626566416, 51 - "x":214.53634085213, 52 - "y":172.431077694236 53 - }], 54 - "opacity":1, 55 - "type":"objectgroup", 56 - "visible":true, 57 - "x":0, 58 - "y":0 59 - }, 60 - { 61 - "id":3, 62 - "image":"", 63 - "name":"Image Layer 1", 64 - "opacity":1, 65 - "type":"imagelayer", 66 - "visible":true, 67 - "x":0, 68 - "y":0 69 - }], 70 - "nextlayerid":4, 71 - "nextobjectid":3, 72 - "orientation":"orthogonal", 73 - "renderorder":"right-down", 74 - "tiledversion":"1.11.2", 75 - "tileheight":16, 76 - "tilesets":[ 1 + { 2 + "backgroundcolor": "#aabbccdd", 3 + "class": "bar", 4 + "compressionlevel": -1, 5 + "height": 30, 6 + "infinite": false, 7 + "layers": [ 8 + { 9 + "class": "bar", 10 + "compression": "zlib", 11 + "data": "eJztwQEBAAAAASD+nzZE1QAAAPBoHCAAAg==", 12 + "encoding": "base64", 13 + "height": 30, 14 + "id": 1, 15 + "name": "Tile Layer 1", 16 + "opacity": 1, 17 + "type": "tilelayer", 18 + "visible": true, 19 + "width": 30, 20 + "x": 0, 21 + "y": 0 22 + }, 23 + { 24 + "draworder": "topdown", 25 + "id": 2, 26 + "name": "Object Layer 1", 27 + "objects": [ 77 28 { 78 - "firstgid":1, 79 - "source":"source_tileset.tsj" 80 - }, 29 + "height": 19, 30 + "id": 1, 31 + "name": "hello", 32 + "rotation": 0, 33 + "text": { 34 + "text": "Hello World", 35 + "wrap": true 36 + }, 37 + "type": "hello_world", 38 + "visible": true, 39 + "width": 91.4375, 40 + "x": 70, 41 + "y": 44 42 + }, 81 43 { 82 - "firstgid":5, 83 - "source":"images_tileset.tsj" 84 - }], 85 - "tilewidth":16, 86 - "type":"map", 87 - "version":"1.10", 88 - "width":30 44 + "height": 84.2105263157895, 45 + "id": 2, 46 + "name": "", 47 + "rotation": 0, 48 + "type": "", 49 + "visible": true, 50 + "width": 100.250626566416, 51 + "x": 214.53634085213, 52 + "y": 172.431077694236 53 + } 54 + ], 55 + "opacity": 1, 56 + "type": "objectgroup", 57 + "visible": true, 58 + "x": 0, 59 + "y": 0 60 + }, 61 + { 62 + "id": 3, 63 + "image": "", 64 + "name": "Image Layer 1", 65 + "opacity": 1, 66 + "type": "imagelayer", 67 + "visible": true, 68 + "x": 0, 69 + "y": 0 70 + } 71 + ], 72 + "nextlayerid": 4, 73 + "nextobjectid": 3, 74 + "orientation": "orthogonal", 75 + "renderorder": "right-down", 76 + "tiledversion": "1.11.2", 77 + "tileheight": 16, 78 + "tilesets": [ 79 + { 80 + "firstgid": 1, 81 + "source": "source_tileset.tsj" 82 + }, 83 + { 84 + "firstgid": 5, 85 + "source": "images_tileset.tsj" 86 + } 87 + ], 88 + "tilewidth": 16, 89 + "type": "map", 90 + "version": "1.10", 91 + "width": 30, 92 + "properties": [ 93 + { 94 + "name": "test_property", 95 + "type": "string", 96 + "value": "test_value" 97 + } 98 + ] 89 99 }
+96 -86
test/map-base64-zstd.tmj
··· 1 - { "backgroundcolor":"#aabbccdd", 2 - "class":"bar", 3 - "compressionlevel":-1, 4 - "height":30, 5 - "infinite":false, 6 - "layers":[ 7 - { 8 - "class":"bar", 9 - "compression":"zstd", 10 - "data":"KLUv\/WAQDU0AABABAAEAC\/YBFg==", 11 - "encoding":"base64", 12 - "height":30, 13 - "id":1, 14 - "name":"Tile Layer 1", 15 - "opacity":1, 16 - "type":"tilelayer", 17 - "visible":true, 18 - "width":30, 19 - "x":0, 20 - "y":0 21 - }, 22 - { 23 - "draworder":"topdown", 24 - "id":2, 25 - "name":"Object Layer 1", 26 - "objects":[ 27 - { 28 - "height":19, 29 - "id":1, 30 - "name":"hello", 31 - "rotation":0, 32 - "text": 33 - { 34 - "text":"Hello World", 35 - "wrap":true 36 - }, 37 - "type":"hello_world", 38 - "visible":true, 39 - "width":91.4375, 40 - "x":70, 41 - "y":44 42 - }, 43 - { 44 - "height":84.2105263157895, 45 - "id":2, 46 - "name":"", 47 - "rotation":0, 48 - "type":"", 49 - "visible":true, 50 - "width":100.250626566416, 51 - "x":214.53634085213, 52 - "y":172.431077694236 53 - }], 54 - "opacity":1, 55 - "type":"objectgroup", 56 - "visible":true, 57 - "x":0, 58 - "y":0 59 - }, 60 - { 61 - "id":3, 62 - "image":"", 63 - "name":"Image Layer 1", 64 - "opacity":1, 65 - "type":"imagelayer", 66 - "visible":true, 67 - "x":0, 68 - "y":0 69 - }], 70 - "nextlayerid":4, 71 - "nextobjectid":3, 72 - "orientation":"orthogonal", 73 - "renderorder":"right-down", 74 - "tiledversion":"1.11.2", 75 - "tileheight":16, 76 - "tilesets":[ 1 + { 2 + "backgroundcolor": "#aabbccdd", 3 + "class": "bar", 4 + "compressionlevel": -1, 5 + "height": 30, 6 + "infinite": false, 7 + "layers": [ 8 + { 9 + "class": "bar", 10 + "compression": "zstd", 11 + "data": "KLUv/WAQDU0AABABAAEAC/YBFg==", 12 + "encoding": "base64", 13 + "height": 30, 14 + "id": 1, 15 + "name": "Tile Layer 1", 16 + "opacity": 1, 17 + "type": "tilelayer", 18 + "visible": true, 19 + "width": 30, 20 + "x": 0, 21 + "y": 0 22 + }, 23 + { 24 + "draworder": "topdown", 25 + "id": 2, 26 + "name": "Object Layer 1", 27 + "objects": [ 77 28 { 78 - "firstgid":1, 79 - "source":"source_tileset.tsj" 80 - }, 29 + "height": 19, 30 + "id": 1, 31 + "name": "hello", 32 + "rotation": 0, 33 + "text": { 34 + "text": "Hello World", 35 + "wrap": true 36 + }, 37 + "type": "hello_world", 38 + "visible": true, 39 + "width": 91.4375, 40 + "x": 70, 41 + "y": 44 42 + }, 81 43 { 82 - "firstgid":5, 83 - "source":"images_tileset.tsj" 84 - }], 85 - "tilewidth":16, 86 - "type":"map", 87 - "version":"1.10", 88 - "width":30 44 + "height": 84.2105263157895, 45 + "id": 2, 46 + "name": "", 47 + "rotation": 0, 48 + "type": "", 49 + "visible": true, 50 + "width": 100.250626566416, 51 + "x": 214.53634085213, 52 + "y": 172.431077694236 53 + } 54 + ], 55 + "opacity": 1, 56 + "type": "objectgroup", 57 + "visible": true, 58 + "x": 0, 59 + "y": 0 60 + }, 61 + { 62 + "id": 3, 63 + "image": "", 64 + "name": "Image Layer 1", 65 + "opacity": 1, 66 + "type": "imagelayer", 67 + "visible": true, 68 + "x": 0, 69 + "y": 0 70 + } 71 + ], 72 + "nextlayerid": 4, 73 + "nextobjectid": 3, 74 + "orientation": "orthogonal", 75 + "renderorder": "right-down", 76 + "tiledversion": "1.11.2", 77 + "tileheight": 16, 78 + "tilesets": [ 79 + { 80 + "firstgid": 1, 81 + "source": "source_tileset.tsj" 82 + }, 83 + { 84 + "firstgid": 5, 85 + "source": "images_tileset.tsj" 86 + } 87 + ], 88 + "tilewidth": 16, 89 + "type": "map", 90 + "version": "1.10", 91 + "width": 30, 92 + "properties": [ 93 + { 94 + "name": "test_property", 95 + "type": "string", 96 + "value": "test_value" 97 + } 98 + ] 89 99 }
+123 -120
test/map-infinite-base64-zstd.tmj
··· 1 - { "backgroundcolor":"#aabbccdd", 2 - "class":"bar", 3 - "compressionlevel":-1, 4 - "editorsettings": 1 + { 2 + "backgroundcolor": "#aabbccdd", 3 + "class": "bar", 4 + "compressionlevel": -1, 5 + "editorsettings": { 6 + "export": { 7 + "format": "json", 8 + "target": "map-infinite-base64-zstd.tmj" 9 + } 10 + }, 11 + "height": 30, 12 + "infinite": true, 13 + "layers": [ 5 14 { 6 - "export": 15 + "chunks": [ 7 16 { 8 - "format":"json", 9 - "target":"map-infinite-base64-zstd.tmj" 17 + "data": "KLUv/WAAA60BAEgHAAAABgUFBQURgHA7Bx0upICpABq3OgGHrQrwylFzR/asmZlUAAUwCNoZZgElX0nFT5cC", 18 + "height": 16, 19 + "width": 16, 20 + "x": 16, 21 + "y": 16 10 22 } 23 + ], 24 + "class": "bar", 25 + "compression": "zstd", 26 + "encoding": "base64", 27 + "height": 16, 28 + "id": 1, 29 + "name": "ground", 30 + "opacity": 1, 31 + "startx": 16, 32 + "starty": 16, 33 + "type": "tilelayer", 34 + "visible": true, 35 + "width": 16, 36 + "x": 0, 37 + "y": 0 11 38 }, 12 - "height":30, 13 - "infinite":true, 14 - "layers":[ 39 + { 40 + "draworder": "topdown", 41 + "id": 2, 42 + "name": "objects", 43 + "objects": [ 15 44 { 16 - "chunks":[ 17 - { 18 - "data":"KLUv\/WAAA60BAEgHAAAABgUFBQURgHA7Bx0upICpABq3OgGHrQrwylFzR\/asmZlUAAUwCNoZZgElX0nFT5cC", 19 - "height":16, 20 - "width":16, 21 - "x":16, 22 - "y":16 23 - }], 24 - "class":"bar", 25 - "compression":"zstd", 26 - "encoding":"base64", 27 - "height":16, 28 - "id":1, 29 - "name":"ground", 30 - "opacity":1, 31 - "startx":16, 32 - "starty":16, 33 - "type":"tilelayer", 34 - "visible":true, 35 - "width":16, 36 - "x":0, 37 - "y":0 38 - }, 45 + "height": 16, 46 + "id": 1, 47 + "name": "pool", 48 + "rotation": 0, 49 + "type": "", 50 + "visible": true, 51 + "width": 16, 52 + "x": 88, 53 + "y": 96 54 + }, 39 55 { 40 - "draworder":"topdown", 41 - "id":2, 42 - "name":"objects", 43 - "objects":[ 44 - { 45 - "height":16, 46 - "id":1, 47 - "name":"pool", 48 - "rotation":0, 49 - "type":"", 50 - "visible":true, 51 - "width":16, 52 - "x":88, 53 - "y":96 54 - }, 55 - { 56 - "height":20, 57 - "id":2, 58 - "name":"", 59 - "rotation":0, 60 - "text": 61 - { 62 - "color":"#241f31", 63 - "fontfamily":"Serif", 64 - "text":"tmz", 65 - "wrap":true 66 - }, 67 - "type":"", 68 - "visible":true, 69 - "width":30, 70 - "x":70, 71 - "y":16 72 - }], 73 - "opacity":1, 74 - "type":"objectgroup", 75 - "visible":true, 76 - "x":0, 77 - "y":0 78 - }, 79 - { 80 - "id":3, 81 - "image":"tilemap.png", 82 - "imageheight":32, 83 - "imagewidth":32, 84 - "name":"tile_image", 85 - "offsetx":1, 86 - "offsety":1, 87 - "opacity":1, 88 - "type":"imagelayer", 89 - "visible":true, 90 - "x":0, 91 - "y":0 92 - }], 93 - "nextlayerid":4, 94 - "nextobjectid":3, 95 - "orientation":"orthogonal", 96 - "properties":[ 97 - { 98 - "name":"beautiful", 99 - "type":"bool", 100 - "value":true 101 - }], 102 - "renderorder":"right-down", 103 - "tiledversion":"1.11.2", 104 - "tileheight":16, 105 - "tilesets":[ 106 - { 107 - "firstgid":1, 108 - "source":"source_tileset.tsj" 109 - }, 110 - { 111 - "columns":2, 112 - "firstgid":5, 113 - "image":"tilemap.png", 114 - "imageheight":32, 115 - "imagewidth":32, 116 - "margin":0, 117 - "name":"embedded_tiles", 118 - "spacing":0, 119 - "tilecount":4, 120 - "tileheight":16, 121 - "tilewidth":16 122 - }], 123 - "tilewidth":16, 124 - "type":"map", 125 - "version":"1.10", 126 - "width":30 56 + "height": 20, 57 + "id": 2, 58 + "name": "", 59 + "rotation": 0, 60 + "text": { 61 + "color": "#241f31", 62 + "fontfamily": "Serif", 63 + "text": "tmz", 64 + "wrap": true 65 + }, 66 + "type": "", 67 + "visible": true, 68 + "width": 30, 69 + "x": 70, 70 + "y": 16 71 + } 72 + ], 73 + "opacity": 1, 74 + "type": "objectgroup", 75 + "visible": true, 76 + "x": 0, 77 + "y": 0 78 + }, 79 + { 80 + "id": 3, 81 + "image": "tilemap.png", 82 + "imageheight": 32, 83 + "imagewidth": 32, 84 + "name": "tile_image", 85 + "offsetx": 1, 86 + "offsety": 1, 87 + "opacity": 1, 88 + "type": "imagelayer", 89 + "visible": true, 90 + "x": 0, 91 + "y": 0 92 + } 93 + ], 94 + "nextlayerid": 4, 95 + "nextobjectid": 3, 96 + "orientation": "orthogonal", 97 + "properties": [ 98 + { 99 + "name": "test_property", 100 + "type": "string", 101 + "value": "test_value" 102 + } 103 + ], 104 + "renderorder": "right-down", 105 + "tiledversion": "1.11.2", 106 + "tileheight": 16, 107 + "tilesets": [ 108 + { 109 + "firstgid": 1, 110 + "source": "source_tileset.tsj" 111 + }, 112 + { 113 + "columns": 2, 114 + "firstgid": 5, 115 + "image": "tilemap.png", 116 + "imageheight": 32, 117 + "imagewidth": 32, 118 + "margin": 0, 119 + "name": "embedded_tiles", 120 + "spacing": 0, 121 + "tilecount": 4, 122 + "tileheight": 16, 123 + "tilewidth": 16 124 + } 125 + ], 126 + "tilewidth": 16, 127 + "type": "map", 128 + "version": "1.10", 129 + "width": 30 127 130 }
+378 -133
test/map-infinite-csv.tmj
··· 1 - { "backgroundcolor":"#aabbccdd", 2 - "class":"bar", 3 - "compressionlevel":-1, 4 - "editorsettings": 1 + { 2 + "backgroundcolor": "#aabbccdd", 3 + "class": "bar", 4 + "compressionlevel": -1, 5 + "editorsettings": { 6 + "export": { 7 + "format": "json", 8 + "target": "map-infinite-base64-zstd.tmj" 9 + } 10 + }, 11 + "height": 30, 12 + "infinite": true, 13 + "layers": [ 5 14 { 6 - "export": 15 + "chunks": [ 7 16 { 8 - "format":"json", 9 - "target":"map-infinite-base64-zstd.tmj" 17 + "data": [ 18 + 7, 19 + 6, 20 + 6, 21 + 6, 22 + 6, 23 + 6, 24 + 6, 25 + 6, 26 + 6, 27 + 6, 28 + 6, 29 + 6, 30 + 6, 31 + 6, 32 + 6, 33 + 7, 34 + 6, 35 + 6, 36 + 6, 37 + 6, 38 + 6, 39 + 6, 40 + 6, 41 + 6, 42 + 6, 43 + 6, 44 + 6, 45 + 6, 46 + 6, 47 + 6, 48 + 6, 49 + 6, 50 + 6, 51 + 6, 52 + 6, 53 + 6, 54 + 6, 55 + 6, 56 + 6, 57 + 6, 58 + 6, 59 + 6, 60 + 6, 61 + 6, 62 + 6, 63 + 6, 64 + 6, 65 + 6, 66 + 6, 67 + 6, 68 + 6, 69 + 6, 70 + 6, 71 + 6, 72 + 6, 73 + 6, 74 + 6, 75 + 6, 76 + 6, 77 + 6, 78 + 6, 79 + 6, 80 + 6, 81 + 6, 82 + 6, 83 + 6, 84 + 6, 85 + 6, 86 + 6, 87 + 6, 88 + 6, 89 + 6, 90 + 6, 91 + 6, 92 + 6, 93 + 6, 94 + 6, 95 + 6, 96 + 6, 97 + 6, 98 + 6, 99 + 6, 100 + 6, 101 + 6, 102 + 6, 103 + 5, 104 + 6, 105 + 6, 106 + 6, 107 + 6, 108 + 6, 109 + 5, 110 + 5, 111 + 6, 112 + 6, 113 + 6, 114 + 6, 115 + 6, 116 + 6, 117 + 6, 118 + 6, 119 + 6, 120 + 6, 121 + 6, 122 + 6, 123 + 6, 124 + 6, 125 + 6, 126 + 6, 127 + 6, 128 + 6, 129 + 6, 130 + 6, 131 + 6, 132 + 6, 133 + 6, 134 + 6, 135 + 6, 136 + 6, 137 + 6, 138 + 6, 139 + 6, 140 + 6, 141 + 6, 142 + 6, 143 + 6, 144 + 6, 145 + 6, 146 + 6, 147 + 6, 148 + 6, 149 + 6, 150 + 6, 151 + 6, 152 + 6, 153 + 5, 154 + 5, 155 + 6, 156 + 6, 157 + 6, 158 + 6, 159 + 6, 160 + 6, 161 + 6, 162 + 6, 163 + 6, 164 + 6, 165 + 6, 166 + 6, 167 + 6, 168 + 6, 169 + 6, 170 + 6, 171 + 6, 172 + 6, 173 + 6, 174 + 6, 175 + 5, 176 + 6, 177 + 6, 178 + 6, 179 + 6, 180 + 6, 181 + 5, 182 + 5, 183 + 6, 184 + 6, 185 + 6, 186 + 6, 187 + 6, 188 + 6, 189 + 5, 190 + 5, 191 + 5, 192 + 6, 193 + 6, 194 + 6, 195 + 6, 196 + 6, 197 + 6, 198 + 5, 199 + 5, 200 + 6, 201 + 6, 202 + 5, 203 + 5, 204 + 5, 205 + 5, 206 + 6, 207 + 6, 208 + 6, 209 + 6, 210 + 6, 211 + 6, 212 + 6, 213 + 6, 214 + 6, 215 + 5, 216 + 5, 217 + 5, 218 + 5, 219 + 5, 220 + 6, 221 + 6, 222 + 6, 223 + 6, 224 + 6, 225 + 6, 226 + 6, 227 + 6, 228 + 6, 229 + 6, 230 + 6, 231 + 6, 232 + 6, 233 + 6, 234 + 6, 235 + 6, 236 + 6, 237 + 6, 238 + 6, 239 + 6, 240 + 6, 241 + 6, 242 + 6, 243 + 6, 244 + 6, 245 + 6, 246 + 6, 247 + 6, 248 + 6, 249 + 6, 250 + 6, 251 + 6, 252 + 6, 253 + 6, 254 + 6, 255 + 6, 256 + 6, 257 + 6, 258 + 7, 259 + 6, 260 + 6, 261 + 6, 262 + 6, 263 + 6, 264 + 6, 265 + 6, 266 + 6, 267 + 6, 268 + 6, 269 + 6, 270 + 6, 271 + 6, 272 + 6, 273 + 7 274 + ], 275 + "height": 16, 276 + "width": 16, 277 + "x": 16, 278 + "y": 16 10 279 } 280 + ], 281 + "class": "bar", 282 + "height": 16, 283 + "id": 1, 284 + "name": "ground", 285 + "opacity": 1, 286 + "startx": 16, 287 + "starty": 16, 288 + "type": "tilelayer", 289 + "visible": true, 290 + "width": 16, 291 + "x": 0, 292 + "y": 0 11 293 }, 12 - "height":30, 13 - "infinite":true, 14 - "layers":[ 294 + { 295 + "draworder": "topdown", 296 + "id": 2, 297 + "name": "objects", 298 + "objects": [ 15 299 { 16 - "chunks":[ 17 - { 18 - "data":[7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 19 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 21 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 22 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 23 - 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 5, 5, 6, 6, 6, 24 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 25 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 26 - 6, 6, 6, 6, 6, 6, 6, 5, 5, 6, 6, 6, 6, 6, 6, 6, 27 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 28 - 6, 6, 6, 5, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 6, 6, 29 - 6, 6, 6, 6, 5, 5, 6, 6, 5, 5, 5, 5, 6, 6, 6, 6, 30 - 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 31 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 32 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 33 - 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7], 34 - "height":16, 35 - "width":16, 36 - "x":16, 37 - "y":16 38 - }], 39 - "class":"bar", 40 - "height":16, 41 - "id":1, 42 - "name":"ground", 43 - "opacity":1, 44 - "startx":16, 45 - "starty":16, 46 - "type":"tilelayer", 47 - "visible":true, 48 - "width":16, 49 - "x":0, 50 - "y":0 51 - }, 300 + "height": 16, 301 + "id": 1, 302 + "name": "pool", 303 + "rotation": 0, 304 + "type": "", 305 + "visible": true, 306 + "width": 16, 307 + "x": 88, 308 + "y": 96 309 + }, 52 310 { 53 - "draworder":"topdown", 54 - "id":2, 55 - "name":"objects", 56 - "objects":[ 57 - { 58 - "height":16, 59 - "id":1, 60 - "name":"pool", 61 - "rotation":0, 62 - "type":"", 63 - "visible":true, 64 - "width":16, 65 - "x":88, 66 - "y":96 67 - }, 68 - { 69 - "height":20, 70 - "id":2, 71 - "name":"", 72 - "rotation":0, 73 - "text": 74 - { 75 - "color":"#241f31", 76 - "fontfamily":"Serif", 77 - "text":"tmz", 78 - "wrap":true 79 - }, 80 - "type":"", 81 - "visible":true, 82 - "width":30, 83 - "x":70, 84 - "y":16 85 - }], 86 - "opacity":1, 87 - "type":"objectgroup", 88 - "visible":true, 89 - "x":0, 90 - "y":0 91 - }, 92 - { 93 - "id":3, 94 - "image":"tilemap.png", 95 - "imageheight":32, 96 - "imagewidth":32, 97 - "name":"tile_image", 98 - "offsetx":1, 99 - "offsety":1, 100 - "opacity":1, 101 - "type":"imagelayer", 102 - "visible":true, 103 - "x":0, 104 - "y":0 105 - }], 106 - "nextlayerid":4, 107 - "nextobjectid":3, 108 - "orientation":"orthogonal", 109 - "properties":[ 110 - { 111 - "name":"beautiful", 112 - "type":"bool", 113 - "value":true 114 - }], 115 - "renderorder":"right-down", 116 - "tiledversion":"1.11.2", 117 - "tileheight":16, 118 - "tilesets":[ 119 - { 120 - "firstgid":1, 121 - "source":"source_tileset.tsj" 122 - }, 123 - { 124 - "columns":2, 125 - "firstgid":5, 126 - "image":"tilemap.png", 127 - "imageheight":32, 128 - "imagewidth":32, 129 - "margin":0, 130 - "name":"embedded_tiles", 131 - "spacing":0, 132 - "tilecount":4, 133 - "tileheight":16, 134 - "tilewidth":16 135 - }], 136 - "tilewidth":16, 137 - "type":"map", 138 - "version":"1.10", 139 - "width":30 311 + "height": 20, 312 + "id": 2, 313 + "name": "", 314 + "rotation": 0, 315 + "text": { 316 + "color": "#241f31", 317 + "fontfamily": "Serif", 318 + "text": "tmz", 319 + "wrap": true 320 + }, 321 + "type": "", 322 + "visible": true, 323 + "width": 30, 324 + "x": 70, 325 + "y": 16 326 + } 327 + ], 328 + "opacity": 1, 329 + "type": "objectgroup", 330 + "visible": true, 331 + "x": 0, 332 + "y": 0 333 + }, 334 + { 335 + "id": 3, 336 + "image": "tilemap.png", 337 + "imageheight": 32, 338 + "imagewidth": 32, 339 + "name": "tile_image", 340 + "offsetx": 1, 341 + "offsety": 1, 342 + "opacity": 1, 343 + "type": "imagelayer", 344 + "visible": true, 345 + "x": 0, 346 + "y": 0 347 + } 348 + ], 349 + "nextlayerid": 4, 350 + "nextobjectid": 3, 351 + "orientation": "orthogonal", 352 + "properties": [ 353 + { 354 + "name": "test_property", 355 + "type": "string", 356 + "value": "test_value" 357 + } 358 + ], 359 + "renderorder": "right-down", 360 + "tiledversion": "1.11.2", 361 + "tileheight": 16, 362 + "tilesets": [ 363 + { 364 + "firstgid": 1, 365 + "source": "source_tileset.tsj" 366 + }, 367 + { 368 + "columns": 2, 369 + "firstgid": 5, 370 + "image": "tilemap.png", 371 + "imageheight": 32, 372 + "imagewidth": 32, 373 + "margin": 0, 374 + "name": "embedded_tiles", 375 + "spacing": 0, 376 + "tilecount": 4, 377 + "tileheight": 16, 378 + "tilewidth": 16 379 + } 380 + ], 381 + "tilewidth": 16, 382 + "type": "map", 383 + "version": "1.10", 384 + "width": 30 140 385 }
+995 -113
test/map.tmj
··· 1 - { "backgroundcolor":"#aabbccdd", 2 - "class":"bar", 3 - "compressionlevel":-1, 4 - "height":30, 5 - "infinite":false, 6 - "layers":[ 7 - { 8 - "class":"bar", 9 - "data":[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 39 - "height":30, 40 - "id":1, 41 - "name":"Tile Layer 1", 42 - "opacity":1, 43 - "type":"tilelayer", 44 - "visible":true, 45 - "width":30, 46 - "x":0, 47 - "y":0 48 - }, 49 - { 50 - "draworder":"topdown", 51 - "id":2, 52 - "name":"Object Layer 1", 53 - "objects":[ 54 - { 55 - "height":19, 56 - "id":1, 57 - "name":"hello", 58 - "rotation":0, 59 - "text": 60 - { 61 - "text":"Hello World", 62 - "wrap":true 63 - }, 64 - "type":"hello_world", 65 - "visible":true, 66 - "width":91.4375, 67 - "x":70, 68 - "y":44 69 - }, 70 - { 71 - "height":84.2105263157895, 72 - "id":2, 73 - "name":"", 74 - "rotation":0, 75 - "type":"", 76 - "visible":true, 77 - "width":100.250626566416, 78 - "x":214.53634085213, 79 - "y":172.431077694236 80 - }], 81 - "opacity":1, 82 - "type":"objectgroup", 83 - "visible":true, 84 - "x":0, 85 - "y":0 86 - }, 87 - { 88 - "id":3, 89 - "image":"", 90 - "name":"Image Layer 1", 91 - "opacity":1, 92 - "type":"imagelayer", 93 - "visible":true, 94 - "x":0, 95 - "y":0 96 - }], 97 - "nextlayerid":4, 98 - "nextobjectid":3, 99 - "orientation":"orthogonal", 100 - "renderorder":"right-down", 101 - "tiledversion":"1.11.2", 102 - "tileheight":16, 103 - "tilesets":[ 1 + { 2 + "backgroundcolor": "#aabbccdd", 3 + "class": "bar", 4 + "compressionlevel": -1, 5 + "height": 30, 6 + "infinite": false, 7 + "layers": [ 8 + { 9 + "class": "bar", 10 + "data": [ 11 + 1, 12 + 0, 13 + 0, 14 + 0, 15 + 0, 16 + 0, 17 + 0, 18 + 0, 19 + 0, 20 + 0, 21 + 0, 22 + 0, 23 + 0, 24 + 0, 25 + 0, 26 + 0, 27 + 0, 28 + 0, 29 + 0, 30 + 0, 31 + 0, 32 + 0, 33 + 0, 34 + 0, 35 + 0, 36 + 0, 37 + 0, 38 + 0, 39 + 0, 40 + 0, 41 + 0, 42 + 0, 43 + 0, 44 + 0, 45 + 0, 46 + 0, 47 + 0, 48 + 0, 49 + 0, 50 + 0, 51 + 0, 52 + 0, 53 + 0, 54 + 0, 55 + 0, 56 + 0, 57 + 0, 58 + 0, 59 + 0, 60 + 0, 61 + 0, 62 + 0, 63 + 0, 64 + 0, 65 + 0, 66 + 0, 67 + 0, 68 + 0, 69 + 0, 70 + 0, 71 + 0, 72 + 0, 73 + 0, 74 + 0, 75 + 0, 76 + 0, 77 + 0, 78 + 0, 79 + 0, 80 + 0, 81 + 0, 82 + 0, 83 + 0, 84 + 0, 85 + 0, 86 + 0, 87 + 0, 88 + 0, 89 + 0, 90 + 0, 91 + 0, 92 + 0, 93 + 0, 94 + 0, 95 + 0, 96 + 0, 97 + 0, 98 + 0, 99 + 0, 100 + 0, 101 + 0, 102 + 0, 103 + 0, 104 + 0, 105 + 0, 106 + 0, 107 + 0, 108 + 0, 109 + 0, 110 + 0, 111 + 0, 112 + 0, 113 + 0, 114 + 0, 115 + 0, 116 + 0, 117 + 0, 118 + 0, 119 + 0, 120 + 0, 121 + 0, 122 + 0, 123 + 0, 124 + 0, 125 + 0, 126 + 0, 127 + 0, 128 + 0, 129 + 0, 130 + 0, 131 + 0, 132 + 0, 133 + 0, 134 + 0, 135 + 0, 136 + 0, 137 + 0, 138 + 0, 139 + 0, 140 + 0, 141 + 0, 142 + 0, 143 + 0, 144 + 0, 145 + 0, 146 + 0, 147 + 0, 148 + 0, 149 + 0, 150 + 0, 151 + 0, 152 + 0, 153 + 0, 154 + 0, 155 + 0, 156 + 0, 157 + 0, 158 + 0, 159 + 0, 160 + 0, 161 + 0, 162 + 0, 163 + 0, 164 + 0, 165 + 0, 166 + 0, 167 + 0, 168 + 0, 169 + 0, 170 + 0, 171 + 0, 172 + 0, 173 + 0, 174 + 0, 175 + 0, 176 + 0, 177 + 0, 178 + 0, 179 + 0, 180 + 0, 181 + 0, 182 + 0, 183 + 0, 184 + 0, 185 + 0, 186 + 0, 187 + 0, 188 + 0, 189 + 0, 190 + 0, 191 + 0, 192 + 0, 193 + 0, 194 + 0, 195 + 0, 196 + 0, 197 + 0, 198 + 0, 199 + 0, 200 + 0, 201 + 0, 202 + 0, 203 + 0, 204 + 0, 205 + 0, 206 + 0, 207 + 0, 208 + 0, 209 + 0, 210 + 0, 211 + 0, 212 + 0, 213 + 0, 214 + 0, 215 + 0, 216 + 0, 217 + 0, 218 + 0, 219 + 0, 220 + 0, 221 + 0, 222 + 0, 223 + 0, 224 + 0, 225 + 0, 226 + 0, 227 + 0, 228 + 0, 229 + 0, 230 + 0, 231 + 0, 232 + 0, 233 + 0, 234 + 0, 235 + 0, 236 + 0, 237 + 0, 238 + 0, 239 + 0, 240 + 0, 241 + 0, 242 + 0, 243 + 0, 244 + 0, 245 + 0, 246 + 0, 247 + 0, 248 + 0, 249 + 0, 250 + 0, 251 + 0, 252 + 0, 253 + 0, 254 + 0, 255 + 0, 256 + 0, 257 + 0, 258 + 0, 259 + 0, 260 + 0, 261 + 0, 262 + 0, 263 + 0, 264 + 0, 265 + 0, 266 + 0, 267 + 0, 268 + 0, 269 + 0, 270 + 0, 271 + 0, 272 + 0, 273 + 0, 274 + 0, 275 + 0, 276 + 0, 277 + 0, 278 + 0, 279 + 0, 280 + 0, 281 + 0, 282 + 0, 283 + 0, 284 + 0, 285 + 0, 286 + 0, 287 + 0, 288 + 0, 289 + 0, 290 + 0, 291 + 0, 292 + 0, 293 + 0, 294 + 0, 295 + 0, 296 + 0, 297 + 0, 298 + 0, 299 + 0, 300 + 0, 301 + 0, 302 + 0, 303 + 0, 304 + 0, 305 + 0, 306 + 0, 307 + 0, 308 + 0, 309 + 0, 310 + 0, 311 + 0, 312 + 0, 313 + 0, 314 + 0, 315 + 0, 316 + 0, 317 + 0, 318 + 0, 319 + 0, 320 + 0, 321 + 0, 322 + 0, 323 + 0, 324 + 0, 325 + 0, 326 + 0, 327 + 0, 328 + 0, 329 + 0, 330 + 0, 331 + 0, 332 + 0, 333 + 0, 334 + 0, 335 + 0, 336 + 0, 337 + 0, 338 + 0, 339 + 0, 340 + 0, 341 + 0, 342 + 0, 343 + 0, 344 + 0, 345 + 0, 346 + 0, 347 + 0, 348 + 0, 349 + 0, 350 + 0, 351 + 0, 352 + 0, 353 + 0, 354 + 0, 355 + 0, 356 + 0, 357 + 0, 358 + 0, 359 + 0, 360 + 0, 361 + 0, 362 + 0, 363 + 0, 364 + 0, 365 + 0, 366 + 0, 367 + 0, 368 + 0, 369 + 0, 370 + 0, 371 + 0, 372 + 0, 373 + 0, 374 + 0, 375 + 0, 376 + 0, 377 + 0, 378 + 0, 379 + 0, 380 + 0, 381 + 0, 382 + 0, 383 + 0, 384 + 0, 385 + 0, 386 + 0, 387 + 0, 388 + 0, 389 + 0, 390 + 0, 391 + 0, 392 + 0, 393 + 0, 394 + 0, 395 + 0, 396 + 0, 397 + 0, 398 + 0, 399 + 0, 400 + 0, 401 + 0, 402 + 0, 403 + 0, 404 + 0, 405 + 0, 406 + 0, 407 + 0, 408 + 0, 409 + 0, 410 + 0, 411 + 0, 412 + 0, 413 + 0, 414 + 0, 415 + 0, 416 + 0, 417 + 0, 418 + 0, 419 + 0, 420 + 0, 421 + 0, 422 + 0, 423 + 0, 424 + 0, 425 + 0, 426 + 0, 427 + 0, 428 + 0, 429 + 0, 430 + 0, 431 + 0, 432 + 0, 433 + 0, 434 + 0, 435 + 0, 436 + 0, 437 + 0, 438 + 0, 439 + 0, 440 + 0, 441 + 0, 442 + 0, 443 + 0, 444 + 0, 445 + 0, 446 + 0, 447 + 0, 448 + 0, 449 + 0, 450 + 0, 451 + 0, 452 + 0, 453 + 0, 454 + 0, 455 + 0, 456 + 0, 457 + 0, 458 + 0, 459 + 0, 460 + 0, 461 + 0, 462 + 0, 463 + 0, 464 + 0, 465 + 0, 466 + 0, 467 + 0, 468 + 0, 469 + 0, 470 + 0, 471 + 0, 472 + 0, 473 + 0, 474 + 0, 475 + 0, 476 + 0, 477 + 0, 478 + 0, 479 + 0, 480 + 0, 481 + 0, 482 + 0, 483 + 0, 484 + 0, 485 + 0, 486 + 0, 487 + 0, 488 + 0, 489 + 0, 490 + 0, 491 + 0, 492 + 0, 493 + 0, 494 + 0, 495 + 0, 496 + 0, 497 + 0, 498 + 0, 499 + 0, 500 + 0, 501 + 0, 502 + 0, 503 + 0, 504 + 0, 505 + 0, 506 + 0, 507 + 0, 508 + 0, 509 + 0, 510 + 0, 511 + 0, 512 + 0, 513 + 0, 514 + 0, 515 + 0, 516 + 0, 517 + 0, 518 + 0, 519 + 0, 520 + 0, 521 + 0, 522 + 0, 523 + 0, 524 + 0, 525 + 0, 526 + 0, 527 + 0, 528 + 0, 529 + 0, 530 + 0, 531 + 0, 532 + 0, 533 + 0, 534 + 0, 535 + 0, 536 + 0, 537 + 0, 538 + 0, 539 + 0, 540 + 0, 541 + 0, 542 + 0, 543 + 0, 544 + 0, 545 + 0, 546 + 0, 547 + 0, 548 + 0, 549 + 0, 550 + 0, 551 + 0, 552 + 0, 553 + 0, 554 + 0, 555 + 0, 556 + 0, 557 + 0, 558 + 0, 559 + 0, 560 + 0, 561 + 0, 562 + 0, 563 + 0, 564 + 0, 565 + 0, 566 + 0, 567 + 0, 568 + 0, 569 + 0, 570 + 0, 571 + 0, 572 + 0, 573 + 0, 574 + 0, 575 + 0, 576 + 0, 577 + 0, 578 + 0, 579 + 0, 580 + 0, 581 + 0, 582 + 0, 583 + 0, 584 + 0, 585 + 0, 586 + 0, 587 + 0, 588 + 0, 589 + 0, 590 + 0, 591 + 0, 592 + 0, 593 + 0, 594 + 0, 595 + 0, 596 + 0, 597 + 0, 598 + 0, 599 + 0, 600 + 0, 601 + 0, 602 + 0, 603 + 0, 604 + 0, 605 + 0, 606 + 0, 607 + 0, 608 + 0, 609 + 0, 610 + 0, 611 + 0, 612 + 0, 613 + 0, 614 + 0, 615 + 0, 616 + 0, 617 + 0, 618 + 0, 619 + 0, 620 + 0, 621 + 0, 622 + 0, 623 + 0, 624 + 0, 625 + 0, 626 + 0, 627 + 0, 628 + 0, 629 + 0, 630 + 0, 631 + 0, 632 + 0, 633 + 0, 634 + 0, 635 + 0, 636 + 0, 637 + 0, 638 + 0, 639 + 0, 640 + 0, 641 + 0, 642 + 0, 643 + 0, 644 + 0, 645 + 0, 646 + 0, 647 + 0, 648 + 0, 649 + 0, 650 + 0, 651 + 0, 652 + 0, 653 + 0, 654 + 0, 655 + 0, 656 + 0, 657 + 0, 658 + 0, 659 + 0, 660 + 0, 661 + 0, 662 + 0, 663 + 0, 664 + 0, 665 + 0, 666 + 0, 667 + 0, 668 + 0, 669 + 0, 670 + 0, 671 + 0, 672 + 0, 673 + 0, 674 + 0, 675 + 0, 676 + 0, 677 + 0, 678 + 0, 679 + 0, 680 + 0, 681 + 0, 682 + 0, 683 + 0, 684 + 0, 685 + 0, 686 + 0, 687 + 0, 688 + 0, 689 + 0, 690 + 0, 691 + 0, 692 + 0, 693 + 0, 694 + 0, 695 + 0, 696 + 0, 697 + 0, 698 + 0, 699 + 0, 700 + 0, 701 + 0, 702 + 0, 703 + 0, 704 + 0, 705 + 0, 706 + 0, 707 + 0, 708 + 0, 709 + 0, 710 + 0, 711 + 0, 712 + 0, 713 + 0, 714 + 0, 715 + 0, 716 + 0, 717 + 0, 718 + 0, 719 + 0, 720 + 0, 721 + 0, 722 + 0, 723 + 0, 724 + 0, 725 + 0, 726 + 0, 727 + 0, 728 + 0, 729 + 0, 730 + 0, 731 + 0, 732 + 0, 733 + 0, 734 + 0, 735 + 0, 736 + 0, 737 + 0, 738 + 0, 739 + 0, 740 + 0, 741 + 0, 742 + 0, 743 + 0, 744 + 0, 745 + 0, 746 + 0, 747 + 0, 748 + 0, 749 + 0, 750 + 0, 751 + 0, 752 + 0, 753 + 0, 754 + 0, 755 + 0, 756 + 0, 757 + 0, 758 + 0, 759 + 0, 760 + 0, 761 + 0, 762 + 0, 763 + 0, 764 + 0, 765 + 0, 766 + 0, 767 + 0, 768 + 0, 769 + 0, 770 + 0, 771 + 0, 772 + 0, 773 + 0, 774 + 0, 775 + 0, 776 + 0, 777 + 0, 778 + 0, 779 + 0, 780 + 0, 781 + 0, 782 + 0, 783 + 0, 784 + 0, 785 + 0, 786 + 0, 787 + 0, 788 + 0, 789 + 0, 790 + 0, 791 + 0, 792 + 0, 793 + 0, 794 + 0, 795 + 0, 796 + 0, 797 + 0, 798 + 0, 799 + 0, 800 + 0, 801 + 0, 802 + 0, 803 + 0, 804 + 0, 805 + 0, 806 + 0, 807 + 0, 808 + 0, 809 + 0, 810 + 0, 811 + 0, 812 + 0, 813 + 0, 814 + 0, 815 + 0, 816 + 0, 817 + 0, 818 + 0, 819 + 0, 820 + 0, 821 + 0, 822 + 0, 823 + 0, 824 + 0, 825 + 0, 826 + 0, 827 + 0, 828 + 0, 829 + 0, 830 + 0, 831 + 0, 832 + 0, 833 + 0, 834 + 0, 835 + 0, 836 + 0, 837 + 0, 838 + 0, 839 + 0, 840 + 0, 841 + 0, 842 + 0, 843 + 0, 844 + 0, 845 + 0, 846 + 0, 847 + 0, 848 + 0, 849 + 0, 850 + 0, 851 + 0, 852 + 0, 853 + 0, 854 + 0, 855 + 0, 856 + 0, 857 + 0, 858 + 0, 859 + 0, 860 + 0, 861 + 0, 862 + 0, 863 + 0, 864 + 0, 865 + 0, 866 + 0, 867 + 0, 868 + 0, 869 + 0, 870 + 0, 871 + 0, 872 + 0, 873 + 0, 874 + 0, 875 + 0, 876 + 0, 877 + 0, 878 + 0, 879 + 0, 880 + 0, 881 + 0, 882 + 0, 883 + 0, 884 + 0, 885 + 0, 886 + 0, 887 + 0, 888 + 0, 889 + 0, 890 + 0, 891 + 0, 892 + 0, 893 + 0, 894 + 0, 895 + 0, 896 + 0, 897 + 0, 898 + 0, 899 + 0, 900 + 0, 901 + 0, 902 + 0, 903 + 0, 904 + 0, 905 + 0, 906 + 0, 907 + 0, 908 + 0, 909 + 0, 910 + 0 911 + ], 912 + "height": 30, 913 + "id": 1, 914 + "name": "Tile Layer 1", 915 + "opacity": 1, 916 + "type": "tilelayer", 917 + "visible": true, 918 + "width": 30, 919 + "x": 0, 920 + "y": 0 921 + }, 922 + { 923 + "draworder": "topdown", 924 + "id": 2, 925 + "name": "Object Layer 1", 926 + "objects": [ 104 927 { 105 - "firstgid":1, 106 - "source":"source_tileset.tsj" 107 - }, 928 + "height": 19, 929 + "id": 1, 930 + "name": "hello", 931 + "rotation": 0, 932 + "text": { 933 + "text": "Hello World", 934 + "wrap": true 935 + }, 936 + "type": "hello_world", 937 + "visible": true, 938 + "width": 91.4375, 939 + "x": 70, 940 + "y": 44 941 + }, 108 942 { 109 - "firstgid":5, 110 - "source":"images_tileset.tsj" 111 - }], 112 - "tilewidth":16, 113 - "type":"map", 114 - "version":"1.10", 115 - "width":30 943 + "height": 84.2105263157895, 944 + "id": 2, 945 + "name": "", 946 + "rotation": 0, 947 + "type": "", 948 + "visible": true, 949 + "width": 100.250626566416, 950 + "x": 214.53634085213, 951 + "y": 172.431077694236 952 + } 953 + ], 954 + "opacity": 1, 955 + "type": "objectgroup", 956 + "visible": true, 957 + "x": 0, 958 + "y": 0 959 + }, 960 + { 961 + "id": 3, 962 + "image": "", 963 + "name": "Image Layer 1", 964 + "opacity": 1, 965 + "type": "imagelayer", 966 + "visible": true, 967 + "x": 0, 968 + "y": 0 969 + } 970 + ], 971 + "nextlayerid": 4, 972 + "nextobjectid": 3, 973 + "orientation": "orthogonal", 974 + "renderorder": "right-down", 975 + "tiledversion": "1.11.2", 976 + "tileheight": 16, 977 + "tilesets": [ 978 + { 979 + "firstgid": 1, 980 + "source": "source_tileset.tsj" 981 + }, 982 + { 983 + "firstgid": 5, 984 + "source": "images_tileset.tsj" 985 + } 986 + ], 987 + "tilewidth": 16, 988 + "type": "map", 989 + "version": "1.10", 990 + "width": 30, 991 + "properties": [ 992 + { 993 + "name": "test_property", 994 + "type": "string", 995 + "value": "test_value" 996 + } 997 + ] 116 998 }
+8
test/maps.zig
··· 105 105 106 106 try expectEqual(480, map.pixelWidth()); 107 107 try expectEqual(480, map.pixelHeight()); 108 + 109 + const properties = map.properties; 110 + try expectEqual(1, properties.size); 111 + 112 + const prop = properties.get("test_property").?; 113 + try expectEqualStrings("test_property", prop.name); 114 + try expectEqual(.string, prop.type); 115 + try expectEqualStrings("test_value", prop.value.string); 108 116 } 109 117 110 118 test "findObject" {