Avoid sys types in chaperone

This commit is contained in:
Travis Finkenauer
2019-02-08 23:52:10 -05:00
committed by Benjamin Saunders
parent ed3a65427f
commit 41e8e1a552
2 changed files with 6 additions and 8 deletions

View File

@ -2,7 +2,7 @@ use std::convert::From;
use openvr_sys as sys;
use {Chaperone, HmdColor_t, HmdQuad_t, HmdVector3_t};
use {Chaperone, HmdColor_t};
/// Chaperone warning states
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
@ -98,13 +98,13 @@ impl Chaperone {
}
/// Returns the 4 corner positions of the PlayArea.
pub fn get_play_area_rect(&self) -> Option<HmdQuad_t> {
let mut play_area_rect = HmdQuad_t {
vCorners: [HmdVector3_t { v: [0.0; 3] }; 4],
pub fn get_play_area_rect(&self) -> Option<[[f32; 3]; 4]> {
let mut r = sys::HmdQuad_t {
vCorners: [sys::HmdVector3_t { v: [0.0; 3] }; 4],
};
let is_ok = unsafe { self.0.GetPlayAreaRect.unwrap()(&mut play_area_rect) };
let is_ok = unsafe { self.0.GetPlayAreaRect.unwrap()(&mut r) };
if is_ok {
Some(play_area_rect)
Some([r.vCorners[0].v, r.vCorners[1].v, r.vCorners[2].v, r.vCorners[3].v])
} else {
None
}

View File

@ -23,8 +23,6 @@ pub use sys::VkPhysicalDevice_T;
pub use sys::VkDevice_T;
pub use sys::VkInstance_T;
pub use sys::VkQueue_T;
pub use sys::HmdQuad_t;
pub use sys::HmdVector3_t;
pub use sys::HmdColor_t;
static INITIALIZED: AtomicBool = ATOMIC_BOOL_INIT;