Merge branch 'persist_debug_checkbox' into 'master'

Persist interface debug checkbox across sessions

See merge request veloren/veloren!3147
This commit is contained in:
Imbris 2022-02-13 19:43:51 +00:00
commit ddcee8448b
2 changed files with 2 additions and 9 deletions

View File

@ -643,7 +643,6 @@ pub struct Show {
intro: bool,
help: bool,
crafting: bool,
debug: bool,
bag: bool,
bag_inv: bool,
trade: bool,
@ -1037,7 +1036,6 @@ impl Hud {
show: Show {
help: false,
intro: false,
debug: false,
bag: false,
bag_inv: false,
trade: false,
@ -3150,12 +3148,8 @@ impl Hud {
InterfaceChange::ToggleHelp(toggle_help) => {
self.show.help = *toggle_help;
},
InterfaceChange::ToggleDebug(toggle_debug) => {
self.show.debug = *toggle_debug;
},
InterfaceChange::ResetInterfaceSettings => {
self.show.help = false;
self.show.debug = false;
},
_ => {},
},
@ -4015,7 +4009,6 @@ impl Hud {
GameInput::ToggleDebug if state => {
global_state.settings.interface.toggle_debug =
!global_state.settings.interface.toggle_debug;
self.show.debug = global_state.settings.interface.toggle_debug;
true
},
#[cfg(feature = "egui-ui")]

View File

@ -228,7 +228,7 @@ impl<'a> Widget for Interface<'a> {
// Debug
let show_debug = ToggleButton::new(
self.show.debug,
self.global_state.settings.interface.toggle_debug,
self.imgs.checkbox,
self.imgs.checkbox_checked,
)
@ -238,7 +238,7 @@ impl<'a> Widget for Interface<'a> {
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
.set(state.ids.debug_button, ui);
if self.show.debug != show_debug {
if self.global_state.settings.interface.toggle_debug != show_debug {
events.push(ToggleDebug(show_debug));
}