fantasy_craft/graphics/tiled_map/
serializers.rs1use macroquad::prelude::*;
2use serde::Deserialize;
3
4#[derive(Debug, Deserialize)]
5pub struct TiledMapData {
6 pub width: u32,
7 pub height: u32,
8 pub tilewidth: u32,
9 pub tileheight: u32,
10 pub tilesets: Vec<TilesetData>,
11 pub layers: Vec<LayerData>
12}
13
14#[derive(Debug, Deserialize)]
15#[allow(dead_code)]
16pub struct TilesetData {
17 pub firstgid: u32,
18 pub name: String,
19 pub columns: u32,
20 pub tilecount: u32,
21 pub imagewidth: u32,
22 pub imageheight: u32,
23 pub image: String,
24 #[serde(default)]
25 pub tilewidth: u32,
26 #[serde(default)]
27 pub tileheight: u32,
28}
29
30#[derive(Debug, Deserialize)]
31#[allow(dead_code)]
32#[serde(tag="type")]
33pub enum LayerData {
34 #[serde(rename = "tilelayer")]
35 TileLayer {
36 name: String,
37 data: Vec<u32>,
38 width: u32,
39 height: u32,
40 visible: bool
41 },
42 #[serde(other)]
43 Other
44}