From bfdaef7850b6ac17bb88f1b314236fb5014aac8e Mon Sep 17 00:00:00 2001 From: tom barrett Date: Fri, 5 Jul 2019 08:59:22 -0500 Subject: now a cells struct whichs layers own, which takes from tileset tiles --- src/property.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/property.rs') diff --git a/src/property.rs b/src/property.rs index fb4e912..b57d54c 100644 --- a/src/property.rs +++ b/src/property.rs @@ -2,10 +2,10 @@ use xml::reader::XmlEvent; use crate::xmlelements::XMLElements; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Property { - pub tile_id: usize, pub entity: Option, + pub rotation: f32, pub keyframe: Option, pub delay: Option, pub spawn: Option, @@ -13,7 +13,7 @@ pub struct Property { } impl Property { - pub fn new(tile_id: usize, property_elements: Vec) -> Property { + pub fn new(property_elements: Vec) -> Property { let entity = match XMLElements::get_attribute_value(&property_elements, "entity") { Ok(entity) => entity.parse().ok(), Err(_) => None, @@ -33,7 +33,7 @@ impl Property { }; Property { - tile_id, + rotation: 0.0, entity, keyframe, delay, @@ -42,3 +42,16 @@ impl Property { } } } + +impl Default for Property { + fn default() -> Property { + Property { + rotation: 0.0, + entity: None, + keyframe: None, + delay: None, + spawn: None, + visible: None, + } + } +} -- cgit v1.2.3