diff options
author | tom barrett <spalf0@gmail.com> | 2019-07-05 08:59:22 -0500 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2019-07-05 08:59:22 -0500 |
commit | bfdaef7850b6ac17bb88f1b314236fb5014aac8e (patch) | |
tree | 748ceca98138b5783655ec181ea905a25a690934 /src/property.rs | |
parent | 6589e5e3df63d5abf85313c4d21097432257f453 (diff) |
now a cells struct whichs layers own, which takes from tileset tiles
Diffstat (limited to 'src/property.rs')
-rw-r--r-- | src/property.rs | 21 |
1 files changed, 17 insertions, 4 deletions
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<String>, + pub rotation: f32, pub keyframe: Option<usize>, pub delay: Option<usize>, pub spawn: Option<String>, @@ -13,7 +13,7 @@ pub struct Property { } impl Property { - pub fn new(tile_id: usize, property_elements: Vec<XmlEvent>) -> Property { + pub fn new(property_elements: Vec<XmlEvent>) -> 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, + } + } +} |