mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
add key to toggle ingame ui elements
Former-commit-id: e57fc5410a93f6e467db4bb198d7510351fb2db6
This commit is contained in:
parent
1d5bf26491
commit
dd607ba9a4
@ -135,6 +135,7 @@ pub struct Show {
|
||||
map: bool,
|
||||
inventory_test_button: bool,
|
||||
mini_map: bool,
|
||||
ingame: bool,
|
||||
|
||||
want_grab: bool,
|
||||
}
|
||||
@ -258,6 +259,7 @@ impl Hud {
|
||||
inventory_test_button: false,
|
||||
mini_map: false,
|
||||
want_grab: true,
|
||||
ingame: true,
|
||||
},
|
||||
to_focus: None,
|
||||
force_ungrab: false,
|
||||
@ -275,7 +277,7 @@ impl Hud {
|
||||
}
|
||||
|
||||
// Nametags and healthbars
|
||||
{
|
||||
if self.show.ingame {
|
||||
let ecs = client.state().ecs();
|
||||
let actor = ecs.read_storage::<comp::Actor>();
|
||||
let pos = ecs.read_storage::<comp::phys::Pos>();
|
||||
@ -650,6 +652,10 @@ impl Hud {
|
||||
self.show.debug = !self.show.debug;
|
||||
true
|
||||
}
|
||||
Key::ToggleIngameUi => {
|
||||
self.show.ingame = !self.show.ingame;
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
WinEvent::KeyDown(key) | WinEvent::KeyUp(key) => match key {
|
||||
|
@ -40,6 +40,7 @@ pub struct ControlSettings {
|
||||
pub toggle_debug: VirtualKeyCode,
|
||||
pub fullscreen: VirtualKeyCode,
|
||||
pub screenshot: VirtualKeyCode,
|
||||
pub toggle_ingame_ui: VirtualKeyCode,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@ -95,6 +96,7 @@ impl Default for Settings {
|
||||
toggle_debug: VirtualKeyCode::F3,
|
||||
fullscreen: VirtualKeyCode::F11,
|
||||
screenshot: VirtualKeyCode::F4,
|
||||
toggle_ingame_ui: VirtualKeyCode::F6,
|
||||
},
|
||||
networking: NetworkingSettings {
|
||||
username: "Username".to_string(),
|
||||
|
@ -60,6 +60,7 @@ impl Window {
|
||||
key_map.insert(settings.controls.toggle_debug, Key::ToggleDebug);
|
||||
key_map.insert(settings.controls.fullscreen, Key::Fullscreen);
|
||||
key_map.insert(settings.controls.screenshot, Key::Screenshot);
|
||||
key_map.insert(settings.controls.toggle_ingame_ui, Key::ToggleIngameUi);
|
||||
|
||||
let tmp = Ok(Self {
|
||||
events_loop,
|
||||
@ -266,6 +267,7 @@ pub enum Key {
|
||||
ToggleDebug,
|
||||
Fullscreen,
|
||||
Screenshot,
|
||||
ToggleIngameUi,
|
||||
}
|
||||
|
||||
/// Represents an incoming event from the window.
|
||||
|
Loading…
Reference in New Issue
Block a user