Crate gcnctrlusb [−] [src]
Provides an interface for reading input from a Nintendo GameCube Controller Adapter for Wii U USB device.
Third party clones such as the 4-port Mayflash adapter in "PC mode" are also supported.
This library depends on libusb
, which is available as a dynamic library on many platforms
including Linux, Windows, and Mac OS X.
Currently, rumble commands are unimplemented.
Usage
extern crate gcnctrlusb;
fn main() {
// Panics if `libusb` is not found or otherwise fails.
let mut scanner = gcnctrlusb::Scanner::new().unwrap();
// Panics if a valid device was not found.
let mut adapter = scanner.find_adapter().unwrap().unwrap();
// Panics if the USB driver fails to open a connection to the device.
let mut listener = adapter.listen().unwrap();
while let Ok(controllers) = listener.read() {
println!("Controller port 1: {:?}", controllers[0]);
}
}
Structs
Adapter |
A wrapper around the unopened USB device. |
Controller |
The state of a GameCube controller at a given moment in time. |
Listener |
An interface that reads packets of controller data on each iteration. |
Scanner |
Searches for GameCube controller adapter USB devices. |
Enums
ControllerKind |
The classification of a GameCube controller. |
Error |
An error that occurs during usage of this library. |