extern crate orbclient;
extern crate orbclient_window_shortcuts;
use orbclient::{Window, Renderer, EventOption, Color};
use orbclient_window_shortcuts::shortcut::{Shortcut, CommonId, ShortcutComparator};
fn window() -> orbclient::Window {
let (width, height) = orbclient::get_display_size().unwrap();
let mut window = Window::new_flags(0, 0, width / 2, height / 2, "Launcher",&[orbclient::WindowFlag::Resizable]).unwrap();
window.sync();
window
}
enum MyId {
Increase, Decrease
}
fn main() {
let mut window = window();
let mut keys: Vec<u8> = Vec::new();
keys.push(orbclient::event::K_CTRL);
keys.push(orbclient::event::K_Q);
keys.sort();
let quit: Shortcut = Shortcut{id: CommonId::Quit, keys: keys};
let mut supported: Vec<Shortcut> = Vec::new();
supported.push(quit);
let mut sceq: ShortcutComparator = ShortcutComparator{pressed: Vec::new(), supported: Some(supported), min_shortcut_len: 1};
'events: loop {
for event in window.events() {
match event.to_option() {
EventOption::Quit(qe) => break 'events,
EventOption::Key(ke) => {
match sceq.update(ke) {
Some(scid) => {
match scid {
&CommonId::Quit => {break 'events },
&CommonId::Open => {println!("{:?} not implemented.", scid)},
_ => {println!("{:?} unknown shortcut.", scid)}
};
},
None => {println!("No match")},
};
}, _ => break
};
}
}
}