From a595ed8d9fbe6ff4a7a6f13c279b5412aeb41ab4 Mon Sep 17 00:00:00 2001 From: LawnCable Date: Fri, 15 Apr 2022 08:37:05 +0200 Subject: layer tiles, draft for object parsing and more --- src/lowlevel/layer.rs | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'src/lowlevel/layer.rs') 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, } +#[derive(Debug)] pub enum LayerData { Tiles(Vec), Chunks(Vec), } + +#[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>, + /// 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, + pub data: LayerData, +} -- cgit v1.2.3-60-g2f50