Expand description
User Input.
§Getting Started
use cala::task::{exec, wait};
use cala::log::{log, Tag};
use cala::input::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
- An event from a
Controller
. - Input
- Input event from any human interface device
- Key
- Input keycode for a key on a keyboard.