8 releases (breaking)

✓ Uses Rust 2018 edition

new 0.7.0 May 23, 2019
0.6.0 May 13, 2019
0.5.0 May 12, 2019
0.4.1 Aug 5, 2018
0.1.0 Jan 21, 2018

#20 in Hardware support

Download history 1/week @ 2019-02-07 2/week @ 2019-02-14 1/week @ 2019-02-21 41/week @ 2019-02-28 43/week @ 2019-03-07 30/week @ 2019-03-21 18/week @ 2019-03-28 7/week @ 2019-04-04 4/week @ 2019-04-11 1/week @ 2019-04-18 7/week @ 2019-04-25 11/week @ 2019-05-02 34/week @ 2019-05-09 14/week @ 2019-05-16

70 downloads per month
Used in 8 crates (2 directly)

MIT / BSL-1.0

41KB
877 lines

Stick

About

Stick is a Rust library for getting joystick, gamepad, or other controller input.

Features

  • Get controller input (Linux)
  • Remap controller input (Linux)
  • Connect to multiple controllers (Linux)
  • CONTROLLER: GameCube controllers (with MAYFLASH adapter)
  • CONTROLLER: Flight simulator joystick
  • CONTROLLER: XBox controller
  • CONTROLLER: PlayStation controller

Getting Started

// jstest.rs
use stick::Port;

fn main() {
    // Connect to all devices.
    let mut port = Port::new();

    // Loop showing state of all devices.
    loop {
        // Cycle through all currently plugged in devices.
        for i in 0..port.update() {
            let device = port.get(i);
            println!("{}: {}", i, device);
        }

        std::thread::sleep(std::time::Duration::from_millis(16));
    }
}

TODO

  • Better haptic (vibration) support
  • CONTROLLER: Emulated joystick
  • CONTROLLER: Probably some other controllers
  • PLATFORM: Windows
  • PLATFORM: MacOS
  • PLATFORM: Android
  • PLATFORM: Nintendo switch

Links

No runtime deps