wrap input bindings in config struct
This commit is contained in:
parent
3548679bbb
commit
031736bea6
6 changed files with 80 additions and 51 deletions
|
@ -26,13 +26,14 @@ impl Default for Input {
|
|||
use KeyboardKey::*;
|
||||
let mut bindings = [(); ActionId::SIZE].map(|_| Vec::new());
|
||||
let mut bind_key = |action, mods, key| {
|
||||
bindings[action as usize] = vec![Binding {
|
||||
bindings[action as usize].push(Binding {
|
||||
modifiers: mods,
|
||||
trigger: InputTrigger::Key(key),
|
||||
}];
|
||||
});
|
||||
};
|
||||
bind_key(ActionId::Undo, vec![KEY_LEFT_CONTROL], KEY_Z);
|
||||
bind_key(ActionId::Redo, vec![KEY_LEFT_CONTROL], KEY_Y);
|
||||
bind_key(ActionId::Redo, vec![KEY_LEFT_CONTROL, KEY_LEFT_SHIFT], KEY_Z);
|
||||
bind_key(ActionId::Copy, vec![KEY_LEFT_CONTROL], KEY_C);
|
||||
bind_key(ActionId::Paste, vec![KEY_LEFT_CONTROL], KEY_V);
|
||||
bind_key(ActionId::ToggleMenu, vec![], KEY_ESCAPE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue