3 releases
0.1.2 | Nov 28, 2020 |
---|---|
0.1.1 | Nov 28, 2020 |
0.1.0 | Nov 28, 2020 |
#689 in Games
17KB
287 lines
gc-adapter
A Rust library for working with the Nintendo Gamecube Controller Adapter
Example
use gc_adapter::GcAdapter;
// get adapter from global context
let mut adapter = GcAdapter::from_usb().unwrap();
// refresh inputs to ensure they are up to date
adapter.refresh_inputs();
// read and display all controller ports
dbg!(adapter.read_controllers());
// enable rumble for only ports 1 and 4
adapter.set_rumble([false, false, false, true]);
std::thread::sleep(std::time::Duration::from_millis(100));
// on drop all rumble will be disabled and the USB connection
// will be cleaned up
let _ = adapter;
lib.rs
:
A library for working with the Nintendo Gamecube controller adapter.
Supports:
- Official Nintendo Gamecube Controller Adapter for Wii U and Switch
- Mayflash Gamecube Controller Adapter (in "Wii U/Switch" mode)
- Other 3rd party adapters (untested)
Example
use gc_adapter::GcAdapter;
// get adapter from global context
let mut adapter = GcAdapter::from_usb().unwrap();
// refresh inputs to ensure they are up to date
adapter.refresh_inputs();
// read and display all controller ports
dbg!(adapter.read_controllers());
// enable rumble for only ports 4
adapter.set_rumble([false, false, false, true]);
std::thread::sleep(std::time::Duration::from_millis(100));
// on drop all rumble will be disabled and the USB connection
// will be cleaned up
let _ = adapter;
Dependencies
~1.5–2.8MB
~53K SLoC