summaryrefslogtreecommitdiff
path: root/src/lowlevel/layer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lowlevel/layer.rs')
-rw-r--r--src/lowlevel/layer.rs44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/lowlevel/layer.rs b/src/lowlevel/layer.rs
index ebb6cae..90fbb14 100644
--- a/src/lowlevel/layer.rs
+++ b/src/lowlevel/layer.rs
@@ -1,8 +1,10 @@
-pub struct LayerTile {
- /// Global Tile Id
- pub gid: u32,
-}
+use std::u32;
+
+use rgb::RGBA;
+
+use super::layer_tile::LayerTile;
+#[derive(Debug)]
pub struct LayerChunk {
pub x: u32,
pub y: u32,
@@ -11,7 +13,41 @@ pub struct LayerChunk {
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,
+}