Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate libc;
- use libc::{c_char, c_int, c_float};
- #[repr(C)]
- #[derive(Clone, Copy)]
- struct ohmd_context;
- #[repr(C)]
- #[derive(Clone, Copy)]
- struct ohmd_device;
- enum ohmd_float_value{
- OHMD_ROTATION_QUAT
- }
- #[link(name = "openhmd")]
- extern {
- fn ohmd_ctx_create() -> ohmd_context;
- fn ohmd_ctx_destroy(ctx: ohmd_context) -> ohmd_context;
- fn ohmd_ctx_get_error(ctx: ohmd_context) -> c_char;
- fn ohmd_ctx_probe(ctx: ohmd_context) -> c_int;
- fn ohmd_ctx_update(ctx: ohmd_context);
- fn ohmd_device_getf(device: ohmd_device, otype: ohmd_float_value, out: c_float) -> c_int;
- fn ohmd_list_open_device(ctx: ohmd_context, index: c_int) -> ohmd_device;
- }
- pub fn test(){
- unsafe{
- let contex = ohmd_ctx_create();
- let probe = ohmd_ctx_probe(contex);
- println!("ohmd_ctx_get_error {} ; ohmd_ctx_probe {}", ohmd_ctx_get_error(contex), probe);
- let device = ohmd_list_open_device(contex, probe);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement