TAB toggles UI visibility in the demo
This commit is contained in:
parent
0166ff96de
commit
dc77a5262f
|
@ -341,6 +341,13 @@ impl<W> DemoApp<W> where W: Window {
|
|||
self.dirty = true;
|
||||
}
|
||||
}
|
||||
Event::KeyDown(Keycode::Tab) => {
|
||||
self.options.ui = match self.options.ui {
|
||||
UIVisibility::None => UIVisibility::Stats,
|
||||
UIVisibility::Stats => UIVisibility::All,
|
||||
UIVisibility::All => UIVisibility::None,
|
||||
}
|
||||
}
|
||||
Event::OpenSVG(ref svg_path) => {
|
||||
let built_svg = load_scene(self.window.resource_loader(), svg_path);
|
||||
self.ui.message = get_svg_building_message(&built_svg);
|
||||
|
|
|
@ -57,6 +57,7 @@ pub enum Event {
|
|||
pub enum Keycode {
|
||||
Alphanumeric(u8),
|
||||
Escape,
|
||||
Tab,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
|
@ -227,6 +227,7 @@ impl WindowImpl {
|
|||
fn convert_sdl_keycode(&self, sdl_keycode: SDLKeycode) -> Option<Keycode> {
|
||||
match sdl_keycode {
|
||||
SDLKeycode::Escape => Some(Keycode::Escape),
|
||||
SDLKeycode::Tab => Some(Keycode::Tab),
|
||||
sdl_keycode if sdl_keycode as i32 >= SDLKeycode::A as i32 &&
|
||||
sdl_keycode as i32 <= SDLKeycode::Z as i32 => {
|
||||
let offset = (sdl_keycode as i32 - SDLKeycode::A as i32) as u8;
|
||||
|
|
Loading…
Reference in New Issue