I've added function keys from F1 thru F12. I understand there are some keyboards with more function keys, so I've also added a const function (like C++ constexpr) to generate a function key. Key::fn_key(n), These can't be used in match statements since Rust disallows function calls in the match, however they can be defined beforehand and used in the match:
win.handle(|w, ev| match ev {
Event::KeyUp => match app::event_key() {
Key::F2 => {
dbg!("F2");
true
}
_ => false,
},
_ => false,
});
using fn_key():
const F12: Key = Key::fn_key(12); // the value can be inlined in the match
win.handle(|w, ev| match ev {
Event::KeyUp => match app::event_key() {
F12 => {
dbg!("F12");
true
}
_ => false,
},
_ => false,
});