Macro winit_input_map::input_map

source ยท
macro_rules! input_map {
    () => { ... };
    ( $( ( $x:expr, $( $k:expr ),* ) ),* ) => { ... };
}
Expand description

creates new input map with binds and actions.

#[derive(ToUsize)]
enum Action {
    Jump,
    Left,
    Right,
    Interact
}
use Action::*;
use winit_input_map::*;
let mut input = input_map!(
    (Jump, KeyCode::Space),
    (Left, KeyCode::KeyA, KeyCode::LeftArrow),
    (Right, KeyCode::KeyD, KeyCode::RightArrow),
    (Interact, MouseButton::Left)
);