Redo settings -> help text, add supplement_events to Window.

Former-commit-id: a0e023c1cce1677cd1178490df9c569b774db6b6
This commit is contained in:
Yeedo 2019-04-25 16:32:59 +01:00
parent 48747dd9a9
commit 44f8e834fc
2 changed files with 1 additions and 24 deletions

View File

@ -480,11 +480,7 @@ pub struct Hud {
mana_percentage: f64, mana_percentage: f64,
inventorytest_button: bool, inventorytest_button: bool,
settings_tab: SettingsTab, settings_tab: SettingsTab,
<<<<<<< HEAD
settings: Settings, settings: Settings,
=======
help_text: String,
>>>>>>> Update help window to use player's keybindings (fix #42)
} }
//#[inline] //#[inline]
@ -536,11 +532,7 @@ impl Hud {
xp_percentage: 0.4, xp_percentage: 0.4,
hp_percentage: 1.0, hp_percentage: 1.0,
mana_percentage: 1.0, mana_percentage: 1.0,
<<<<<<< HEAD
settings: settings, settings: settings,
=======
help_text: get_help_text(&Settings::default().controls),
>>>>>>> Update help window to use player's keybindings (fix #42)
} }
} }
@ -1772,11 +1764,7 @@ impl Hud {
}, },
WinEvent::Char(_) => self.typing(), WinEvent::Char(_) => self.typing(),
WinEvent::SettingsChanged => { WinEvent::SettingsChanged => {
<<<<<<< HEAD
self.settings = global_state.settings.clone(); self.settings = global_state.settings.clone();
=======
self.help_text = get_help_text(&global_state.settings.controls);
>>>>>>> Update help window to use player's keybindings (fix #42)
true true
}, },
_ => false, _ => false,

View File

@ -11,7 +11,6 @@ pub struct Window {
window: glutin::GlWindow, window: glutin::GlWindow,
cursor_grabbed: bool, cursor_grabbed: bool,
needs_refresh_resize: bool, needs_refresh_resize: bool,
settings_changed: bool,
key_map: HashMap<glutin::VirtualKeyCode, Key>, key_map: HashMap<glutin::VirtualKeyCode, Key>,
supplement_events: Vec<Event>, supplement_events: Vec<Event>,
} }
@ -61,7 +60,6 @@ impl Window {
window, window,
cursor_grabbed: false, cursor_grabbed: false,
needs_refresh_resize: false, needs_refresh_resize: false,
settings_changed: true,
key_map, key_map,
supplement_events: vec![], supplement_events: vec![],
}); });
@ -84,11 +82,6 @@ impl Window {
self.needs_refresh_resize = false; self.needs_refresh_resize = false;
} }
if self.settings_changed {
events.push(Event::SettingsChanged);
self.settings_changed = false;
}
// Copy data that is needed by the events closure to avoid lifetime errors // Copy data that is needed by the events closure to avoid lifetime errors
// TODO: Remove this if/when the compiler permits it // TODO: Remove this if/when the compiler permits it
let cursor_grabbed = self.cursor_grabbed; let cursor_grabbed = self.cursor_grabbed;
@ -219,8 +212,4 @@ pub enum Event {
Ui(ui::Event), Ui(ui::Event),
/// Game settings have changed /// Game settings have changed
SettingsChanged, SettingsChanged,
<<<<<<< HEAD }
}
=======
}
>>>>>>> Update help window to use player's keybindings (fix #42)