rust-webvr 0.2.0

Safe rust API that provides a way to interact with Virtual Reality headsets and integration with vendor specific SDKs like OpenVR and Oculus. The API is inspired on the easy to use WebVR API but adapted to Rust design patterns
Documentation
use std::sync::Arc;
use std::cell::RefCell;
use VRPose;

pub type VRGamepadPtr = Arc<RefCell<VRGamepad>>;

pub trait VRGamepad {
    fn id(&self) -> u64;
    fn name(&self) -> String;
    fn state(&self) -> VRGamepadState;
}

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
pub struct VRGamepadState {
    pub connected: bool,
    pub timestamp: f64,
    pub axes: Vec<f64>,
    pub buttons: Vec<VRGamepadButton>,
    pub pose: VRPose
}

impl Default for VRGamepadState {
     fn default() -> VRGamepadState {
         VRGamepadState {
            connected: false,
            timestamp: 0.0,
            axes: Vec::new(),
            buttons: Vec::new(),
            pose: VRPose::default()
         }
     }
}

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
pub struct VRGamepadButton {
    pub pressed: bool,
    pub touched: bool
}