mirror of
https://github.com/mii443/rust-openvr.git
synced 2025-08-22 16:25:36 +00:00
Now uses new sys binding
- refactored Struct_ and Enum_ prefixes from old bindgen version - added error implementation for rendering system (was blocked by valve) - started with camera implementation (has_camera done)
This commit is contained in:
26
examples/camera.rs
Normal file
26
examples/camera.rs
Normal file
@ -0,0 +1,26 @@
|
||||
extern crate openvr;
|
||||
|
||||
pub fn main () {
|
||||
// init vr system
|
||||
let system = match openvr::init() {
|
||||
Ok(ivr) => ivr,
|
||||
Err(err) => {
|
||||
println!("Failed to create IVRSystem subsystem {:?}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let camera = match openvr::subsystems::tracked_camera() {
|
||||
Ok(ivr) => ivr,
|
||||
Err(err) => {
|
||||
println!("Failed to create IVRTrackedCamera subsystem {:?}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
for device in system.tracked_devices(0.0).connected_iter() {
|
||||
println!("Device found: {}", device.index);
|
||||
println!("\t{:?}", device.device_class());
|
||||
println!("\t{:?}", camera.has_camera(&device));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user