Fix with alpha

This commit is contained in:
Colin Sherratt
2015-01-09 15:11:36 -07:00
parent e501358503
commit c583bb05cb
2 changed files with 19 additions and 15 deletions

View File

@ -34,24 +34,24 @@ fn main() {
Some(sd) => { Some(sd) => {
println!("Vendor id: {:x}", sd.vendor_id); println!("Vendor id: {:x}", sd.vendor_id);
println!("Product id: {:x}", sd.product_id); println!("Product id: {:x}", sd.product_id);
println!("Serial number: {}", sd.serial_number); println!("Serial number: {:?}", sd.serial_number);
} }
None => println!("Failed to get sensor description"), None => println!("Failed to get sensor description"),
} }
let hmd_desc = hmd.get_description(); let hmd_desc = hmd.get_description();
println!("Hmd Type: {}", hmd_desc.hmd_type); println!("Hmd Type: {:?}", hmd_desc.hmd_type);
println!("Product Name: {}", hmd_desc.product_name); println!("Product Name: {:?}", hmd_desc.product_name);
println!("Manufacture: {}", hmd_desc.manufacture); println!("Manufacture: {:?}", hmd_desc.manufacture);
println!("Hmd Capabilities: {}", hmd_desc.hmd_capabilities); println!("Hmd Capabilities: {:?}", hmd_desc.hmd_capabilities);
println!("Sensor Capabilities: {}", hmd_desc.sensor_capabilities); println!("Sensor Capabilities: {:?}", hmd_desc.sensor_capabilities);
println!("Distortion Capabilities: {}", hmd_desc.distortion_capabilities); println!("Distortion Capabilities: {:?}", hmd_desc.distortion_capabilities);
println!("Resolution: {}", hmd_desc.resolution); println!("Resolution: {:?}", hmd_desc.resolution);
println!("Window Position: {}", hmd_desc.window_position); println!("Window Position: {:?}", hmd_desc.window_position);
println!("right: {}", hmd_desc.eye_fovs.right); println!("right: {:?}", hmd_desc.eye_fovs.right);
println!("left {}", hmd_desc.eye_fovs.left); println!("left {:?}", hmd_desc.eye_fovs.left);
println!("Eyes render order: [{}, {}]", hmd_desc.eye_render_order[0], hmd_desc.eye_render_order[1]); println!("Eyes render order: [{:?}, {:?}]", hmd_desc.eye_render_order[0], hmd_desc.eye_render_order[1]);
println!("Display device name: {}", hmd_desc.display_device_name); println!("Display device name: {:?}", hmd_desc.display_device_name);
println!("Display id: {}", hmd_desc.display_id); println!("Display id: {:?}", hmd_desc.display_id);
} }

View File

@ -9,6 +9,7 @@ extern crate libc;
use libc::{c_int, c_uint, c_void, c_float, c_double}; use libc::{c_int, c_uint, c_void, c_float, c_double};
use std::default::Default; use std::default::Default;
use std::ptr; use std::ptr;
use std::path::BytesContainer;
use cgmath::Quaternion; use cgmath::Quaternion;
use cgmath::{Vector2, Vector3}; use cgmath::{Vector2, Vector3};
@ -974,7 +975,10 @@ pub struct HmdDescription {
fn from_buf(ptr: *const u8) -> String { fn from_buf(ptr: *const u8) -> String {
use std::ffi::{CString, c_str_to_bytes}; use std::ffi::{CString, c_str_to_bytes};
unsafe { CString::from_slice(c_str_to_bytes(&(ptr as *const i8))).to_string() } unsafe { CString::from_slice(c_str_to_bytes(&(ptr as *const i8)))
.container_as_str()
.unwrap()
.to_string() }
} }
impl HmdDescription { impl HmdDescription {