blob: 005112948a129284e1e16dff8bffa7e85d91b203 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# fast_tiled
Parser for the tmx format Version 1.5
## Goals
- fast parsing of tiled files
- a low level (to parse single files)
- a higher level API (point to a map and it loads all tile-maps it references, or loads an entire world from a world file and stuff like that)
## The plan
The idea is to first have something low level that just parses the tmx/tsx files and provides them in rust types.
After that is done there could be more high level methods/struct that provide more high level functionality.
Wishlist (things that would be nice):
- serializing from rust types back to tmx/tsx (this needs including another xml lib, because roxmltree if fast because it is read-only)
- parsing from and serializing back to the tiled JSON based formats
- maybe later support parsing older formats
## Thanks to
- https://docs.rs/tmx/0.3.1/ - Inspiration for data types.
## Notes:
Move: version="1.4" tiledversion="1.4.3" to some kind of file-wrapper type? Because it is also present in tilesets? Or just add those two to tileset and inherit it if its inline/embedded.
## progress
| element | rust representation | parse from XML | tests for parse |
| -------------------- | ------------------- | -------------- | --------------- |
| `<map>` | partial | - | - |
| `<editorsettings>` | - | - | - |
| `.<chunksize>` | - | - | - |
| `.<export>` | - | - | - |
| `<tileset>` | complete | - | - |
| `.<tileoffset>` | complete | complete | complete |
| `.<grid>` | complete | complete | complete |
| `.<image>` | partial | partial | partial |
| `..image in <data>` | partial | - | - |
| `.<terraintypes>` | complete | - | - |
| `..<terrain>` | complete | complete | - |
| `.<transformations>` | complete | complete | complete |
| `.<tile>` | partial (5/6) | partial (5/6) | partial (3/6) |
| `..<animation>` | complete | complete | complete |
| `.<frame>` | complete | complete | complete |
| `.<wangsets>` | complete | complete | - |
| `..<wangset>` | complete | complete | complete |
| `...<wangcolor>` | complete | complete | complete |
| `...<wangtile>` | complete | complete | complete |
| `....Wang ID` | complete | complete | complete |
| `<layer>` | partial | - | - |
| `.<data>` | - | - | - |
| `..Tile_gid` | complete | complete | complete |
| `..Tile_flip` | complete | complete | complete |
| `.<chunk>` | - | - | - |
| `.<tile>` | - | - | - |
| `<objectgroup>` | - | - | - |
| `.<object>` | - | - | - |
| `.<ellipse>` | - | - | - |
| `.<point>` | - | - | - |
| `.<polygon>` | - | - | - |
| `.<polyline>` | - | - | - |
| `.<text>` | - | - | - |
| `<imagelayer>` | - | - | - |
| `<group>` | - | - | - |
| `<properties>` | complete | yes | yes |
| `.<property>` | complete | yes | yes |
| `<template>` | - | - | - |
## TODO
- [ ] Add some context to possible errors (for example the node that failed to parse)
|