diff options
author | LawnCable <git@lawncable.net> | 2022-04-15 08:37:05 +0200 |
---|---|---|
committer | LawnCable <git@lawncable.net> | 2022-04-15 08:37:05 +0200 |
commit | a595ed8d9fbe6ff4a7a6f13c279b5412aeb41ab4 (patch) | |
tree | 843069077a21fe5598a1a52f6bf4bab4183d10a2 /src/lowlevel/layer.rs | |
parent | d775eb1e9c6be67e5c07cabde79145b4ed3136e1 (diff) | |
download | fast-tiled.rs-a595ed8d9fbe6ff4a7a6f13c279b5412aeb41ab4.tar.gz fast-tiled.rs-a595ed8d9fbe6ff4a7a6f13c279b5412aeb41ab4.tar.bz2 fast-tiled.rs-a595ed8d9fbe6ff4a7a6f13c279b5412aeb41ab4.tar.xz fast-tiled.rs-a595ed8d9fbe6ff4a7a6f13c279b5412aeb41ab4.zip |
layer tiles, draft for object parsing and more
Diffstat (limited to 'src/lowlevel/layer.rs')
-rw-r--r-- | src/lowlevel/layer.rs | 44 |
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, +} |