make_controls

Macro make_controls 

Source
macro_rules! make_controls {
    ( $( ($A: expr, $I: expr) $(,)? ),*) => { ... };
}
Expand description

Eases the creation of large control schemes by accepting any number of tuples with with the type (A: Into<Action>, I: Into<UniversalInput>).

use action_maps::prelude::*;
use bevy::prelude::*;

let mut control_scheme = ControlScheme::default();
control_scheme.insert("A", KeyCode::A);
control_scheme.insert("W", KeyCode::W);

let with_macro = make_controls!(
    ("A", KeyCode::A),
    ("W", KeyCode::W),
);

assert_eq!(control_scheme, with_macro);