gilrs 0.1.0

Game Input Library for Rust
docs.rs failed to build gilrs-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: gilrs-0.10.7

GilRs - Game Input Library for Rust

build status

Documentation

GilRs abstract platform specific APIs to provide unified interfaces for working with gamepads. Additionally, library is trying to unify different devices, providing single controller layout.

Example

use gilrs::{Gilrs, Button};

let mut gilrs = Gilrs::new();

// Event loop
loop {
    for (id, event) in gilrs.pool_events() {
        println!("New event from {}: {:?}", id, event);
    }

    if gilrs.gamepad(0).is_btn_pressed(Button::South) {
        println!("Name of gamepad 0: {}", gilrs.gamepad(0).name());
    }
}

Supported features

Input Hotplugging Mappings Force feedback
Linux
Windows (XInput) n/a
Windows (DInput)
OS X
Android

Platform specific notes

Linux

On Linux, GilRs read (and write, in case of force feedback) directly from appropriate /dev/input/event* file. This mean that user have to have read and write access to this file. On most distros it shouldn't be a problem, but if it is, you will have to create udev rule.

License

This project is licensed under the terms of both the Apache License (Version 2.0) and the MIT license. See LICENSE-APACHE and LICENSE-MIT for details.