[][src]Crate human

Getting Started

Add the following to your Cargo.toml:

[dependencies]
human = "0.2"
pasts = "0.7"
devout = "0.2"
use pasts::{exec, wait};
use devout::{log, Tag};
use human::Input;

const INFO: Tag = Tag::new("Info").show(true);

/// The program's shared state.
struct State {}

/// Event handled by the event loop.
enum Event {
    Input(Input),
}

impl State {
    /// Event loop.
    fn event(&mut self, event: Event) {
        match event {
            Event::Input(input) => log!(INFO, "Input: {:?}", input),
        }
    }
}

/// Start the async executor.
fn main() {
    let mut state = State {};
    let mut input = human::Input::listener();

    exec!(state.event(wait! {
        Event::Input((&mut input).await),
    }));
}

Structs

Controller

A gamepad, flightstick, smartphone, or other controller.

Mod

Modifier state.

Enums

Btn

Input keycode for a button on a mouse.

Controls

Input event from a controller.

Input

Input event from any human interface device

Key

Input keycode for a key on a keyboard.