4 releases
Uses old Rust 2015
0.1.3 | Dec 12, 2017 |
---|---|
0.1.2 | Mar 12, 2017 |
0.1.1 | Mar 29, 2016 |
0.1.0 | Mar 29, 2016 |
#902 in Hardware support
25 downloads per month
7KB
55 lines
This is a library to get joystick input.
Example usage:
let mut js_dev = joy::Device::open("/dev/input/js0\0".as_bytes()).unwrap();
loop {
for ev in &mut js_dev {
use joy::Event::*;
match ev {
Axis(n, x) => println!("axis {} moved to {}", n, x),
Button(n, true) => println!("button {} pressed", n),
Button(n, false) => println!("button {} released", n),
}
}
}
lib.rs
:
This is a library to get joystick input.
Example usage:
let mut js_dev = joy::Device::open("/dev/input/js0\0".as_bytes()).unwrap();
loop {
for ev in &mut js_dev {
use joy::Event::*;
match ev {
Axis(n, x) => println!("axis {} moved to {}", n, x),
Button(n, true) => println!("button {} pressed", n),
Button(n, false) => println!("button {} released", n),
}
}
}
Dependencies
~180KB