From 0c3affc00d2c986dbe53749a9fd2fe0aea8e819b Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Mon, 17 Jul 2017 21:09:45 -0700 Subject: [PATCH] Render model component state helpers --- src/render_models.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/render_models.rs b/src/render_models.rs index 855c5dc..e7642cb 100644 --- a/src/render_models.rs +++ b/src/render_models.rs @@ -239,6 +239,14 @@ pub struct ComponentState { pub properties: ComponentProperties, } +impl ComponentState { + pub fn is_static(&self) -> bool { self.properties & component_properties::IS_STATIC != 0 } + pub fn is_visible(&self) -> bool { self.properties & component_properties::IS_VISIBLE != 0 } + pub fn is_touched(&self) -> bool { self.properties & component_properties::IS_TOUCHED != 0 } + pub fn is_pressed(&self) -> bool { self.properties & component_properties::IS_PRESSED != 0 } + pub fn is_scrolled(&self) -> bool { self.properties & component_properties::IS_SCROLLED != 0 } +} + type ComponentProperties = sys::VRComponentProperties; pub mod component_properties {