Expand description
§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§
- A gamepad, flightstick, smartphone, or other controller.
- Modifier state.
Enums§
- Input keycode for a button on a mouse.
- Input event from a controller.
- Input event from any human interface device
- Input keycode for a key on a keyboard.