diff --git a/Cargo.toml b/Cargo.toml index 21422fe..f88dced 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ description = "A safe binding for openvr." [dependencies] openvr_sys = { git = "https://github.com/Ralith/rust-openvr-sys.git", branch = "enum-rename" } +lazy_static = "0.2.8" [dev_dependencies] glium = "0.14.0" diff --git a/src/lib.rs b/src/lib.rs index f413249..97301e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,6 @@ extern crate openvr_sys; +#[macro_use] +extern crate lazy_static; use std::sync::atomic::{Ordering, AtomicBool, ATOMIC_BOOL_INIT}; use std::{fmt, error, ptr, mem}; diff --git a/src/render_models.rs b/src/render_models.rs index 8c077ad..4c18786 100644 --- a/src/render_models.rs +++ b/src/render_models.rs @@ -259,3 +259,19 @@ pub mod component_properties { pub const IS_PRESSED: ComponentProperties = sys::EVRComponentProperty_VRComponentProperty_IsPressed; pub const IS_SCROLLED: ComponentProperties = sys::EVRComponentProperty_VRComponentProperty_IsScrolled; } + +pub mod component { + pub mod controller { + use std::ffi::CStr; + use openvr_sys as sys; + + // TODO: Real constants + lazy_static! { + pub static ref GDC2015: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_GDC2015) }; + pub static ref BASE: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Base) }; + pub static ref TIP: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Tip) }; + pub static ref HAND_GRIP: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_HandGrip) }; + pub static ref STATUS: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Status) }; + } + } +}