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::u32;
use rgb::RGBA;
use super::layer_tile::LayerTile;
#[derive(Debug)]
pub struct LayerChunk {
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
pub data: Vec<LayerTile>,
}
#[derive(Debug)]
pub enum LayerData {
Tiles(Vec<LayerTile>),
Chunks(Vec<LayerChunk>),
}
#[derive(Debug)]
pub struct Layer {
/// Unique ID of the layer. Each layer that added to a map gets a unique id. Even if a layer is
/// deleted, no layer ever gets the same ID. Can not be changed in Tiled. (since Tiled 1.2)
pub id: u32,
/// The name of the layer. (defaults to “”)
pub name: String,
/// The x coordinate of the layer in tiles. Defaults to 0 and can not be changed in Tiled.
pub x: u32,
/// The y coordinate of the layer in tiles. Defaults to 0 and can not be changed in Tiled.
pub y: u32,
/// The width of the layer in tiles. Always the same as the map width for fixed-size maps.
pub width: u32,
/// The height of the layer in tiles. Always the same as the map height for fixed-size maps.
pub height: u32,
/// The opacity of the layer as a value from 0 to 1. Defaults to 1.
pub opacity: f32,
/// Whether the layer is shown (1) or hidden (0). Defaults to 1.
pub visible: bool,
/// A tint color that is multiplied with any tiles drawn by this layer in #AARRGGBB or #RRGGBB format (optonal).
pub tintcolor: Option<RGBA<u8>>,
/// Horizontal offset for this layer in pixels. Defaults to 0. (since 0.14)
pub offsetx: u32,
/// Vertical offset for this layer in pixels. Defaults to 0. (since 0.14)
pub offsety: u32,
// /// Horizontal parallax factor for this layer. Defaults to 1. (since 1.5)
// pub parallaxx: ?
// /// Vertical parallax factor for this layer. Defaults to 1. (since 1.5)
// pub parallaxy: ?
pub properties: Option<super::property::Properties>,
pub data: LayerData,
}
|