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
use std::collections::HashMap;
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(default)]
pub struct Layer {
pub name: String,
pub opacity: f32,
pub properties: Option<HashMap<String, String>>,
pub visible: bool,
pub width: u32,
pub height: u32,
pub x: f32,
pub y: f32,
#[serde(rename = "type")]
pub _type: String,
pub data: Vec<u32>,
pub draworder: String,
pub objects: Vec<Object>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(default)]
pub struct Object {
pub id: u32,
pub name: String,
#[serde(rename = "type")]
pub _type: String,
pub gid: Option<u32>,
pub ellipse: Option<bool>,
pub polygon: Option<Vec<PolyPoint>>,
pub properties: HashMap<String, String>,
pub rotation: f32,
pub visible: bool,
pub height: f32,
pub width: f32,
pub x: f32,
pub y: f32,
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
pub struct PolyPoint {
pub x: f32,
pub y: f32,
}