mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
hide entire hud when toggling interface
Former-commit-id: 969564ecfd85df0477db4216cd8974adf2df1921
This commit is contained in:
@ -487,7 +487,11 @@ impl Hud {
|
||||
const MANA_COLOR: Color = Color::Rgba(0.42, 0.41, 0.66, 1.0);
|
||||
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
|
||||
|
||||
if self.show_ui {
|
||||
// Don't show anything if the ui is toggled off
|
||||
if !self.show_ui {
|
||||
return events;
|
||||
}
|
||||
|
||||
// Add Bag-Space Button
|
||||
if self.inventorytest_button {
|
||||
if Button::image(self.imgs.mmap_button)
|
||||
@ -858,7 +862,7 @@ impl Hud {
|
||||
//.label_font_size(5)
|
||||
//.set(self.ids.inv_slot[i], ui_widgets);}
|
||||
}
|
||||
}
|
||||
|
||||
// Bag
|
||||
if !self.map_open {
|
||||
self.bag_open = ToggleButton::new(self.bag_open, self.imgs.bag, self.imgs.bag_open)
|
||||
@ -1538,13 +1542,18 @@ impl Hud {
|
||||
pub fn handle_event(&mut self, event: WinEvent) -> bool {
|
||||
match event {
|
||||
WinEvent::Ui(event) => {
|
||||
if (self.typing() && event.is_keyboard())
|
||||
if (self.typing() && event.is_keyboard() && self.show_ui)
|
||||
|| !(self.cursor_grabbed && event.is_keyboard_or_mouse())
|
||||
{
|
||||
self.ui.handle_event(event);
|
||||
}
|
||||
true
|
||||
}
|
||||
WinEvent::KeyDown(Key::ToggleInterface) => {
|
||||
self.toggle_ui();
|
||||
true
|
||||
}
|
||||
_ if !self.show_ui => false,
|
||||
WinEvent::Zoom(_) => !self.cursor_grabbed && !self.ui.no_widget_capturing_mouse(),
|
||||
WinEvent::KeyDown(Key::Enter) => {
|
||||
self.ui.focus_widget(if self.typing() {
|
||||
@ -1596,10 +1605,6 @@ impl Hud {
|
||||
self.toggle_help();
|
||||
true
|
||||
}
|
||||
Key::Interface => {
|
||||
self.toggle_ui();
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
WinEvent::KeyDown(key) | WinEvent::KeyUp(key) => match key {
|
||||
|
@ -34,7 +34,7 @@ pub struct ControlSettings {
|
||||
pub spellbook: VirtualKeyCode,
|
||||
pub settings: VirtualKeyCode,
|
||||
pub help: VirtualKeyCode,
|
||||
pub interface: VirtualKeyCode,
|
||||
pub toggle_interface: VirtualKeyCode,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
@ -56,7 +56,7 @@ impl Default for Settings {
|
||||
spellbook: VirtualKeyCode::P,
|
||||
settings: VirtualKeyCode::N,
|
||||
help: VirtualKeyCode::F1,
|
||||
interface: VirtualKeyCode::F2,
|
||||
toggle_interface: VirtualKeyCode::F2,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ impl Window {
|
||||
key_map.insert(settings.controls.spellbook, Key::Spellbook);
|
||||
key_map.insert(settings.controls.settings, Key::Settings);
|
||||
key_map.insert(settings.controls.help, Key::Help);
|
||||
key_map.insert(settings.controls.interface, Key::Interface);
|
||||
key_map.insert(settings.controls.toggle_interface, Key::ToggleInterface);
|
||||
|
||||
let tmp = Ok(Self {
|
||||
events_loop,
|
||||
@ -180,7 +180,7 @@ pub enum Key {
|
||||
Social,
|
||||
Spellbook,
|
||||
Settings,
|
||||
Interface,
|
||||
ToggleInterface,
|
||||
Help,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user