mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added ability to toggle zoom inversion in settings
Displayed as checkbox under the Gameplay tab.
This commit is contained in:
parent
f149182290
commit
8680e92548
@ -152,6 +152,7 @@ pub enum Event {
|
||||
SendMessage(String),
|
||||
AdjustMousePan(u32),
|
||||
AdjustMouseZoom(u32),
|
||||
ToggleZoomInvert(bool),
|
||||
AdjustViewDistance(u32),
|
||||
AdjustMusicVolume(f32),
|
||||
AdjustSfxVolume(f32),
|
||||
@ -797,6 +798,9 @@ impl Hud {
|
||||
settings_window::Event::AdjustMouseZoom(sensitivity) => {
|
||||
events.push(Event::AdjustMouseZoom(sensitivity));
|
||||
}
|
||||
settings_window::Event::ToggleZoomInvert(zoom_inverted) => {
|
||||
events.push(Event::ToggleZoomInvert(zoom_inverted));
|
||||
}
|
||||
settings_window::Event::AdjustViewDistance(view_distance) => {
|
||||
events.push(Event::AdjustViewDistance(view_distance));
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ widget_ids! {
|
||||
mouse_zoom_slider,
|
||||
mouse_zoom_label,
|
||||
mouse_zoom_value,
|
||||
mouse_zoom_invert_button,
|
||||
mouse_zoom_invert_label,
|
||||
ch_title,
|
||||
ch_transp_slider,
|
||||
ch_transp_label,
|
||||
@ -154,6 +156,7 @@ pub enum Event {
|
||||
Close,
|
||||
AdjustMousePan(u32),
|
||||
AdjustMouseZoom(u32),
|
||||
ToggleZoomInvert(bool),
|
||||
AdjustViewDistance(u32),
|
||||
AdjustFOV(u16),
|
||||
ChangeAaMode(AaMode),
|
||||
@ -885,6 +888,30 @@ impl<'a> Widget for SettingsWindow<'a> {
|
||||
.font_id(self.fonts.opensans)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.mouse_zoom_value, ui);
|
||||
|
||||
// Zoom Inversion
|
||||
let zoom_inverted = ToggleButton::new(
|
||||
self.global_state.settings.gameplay.zoom_inversion,
|
||||
self.imgs.checkbox,
|
||||
self.imgs.checkbox_checked,
|
||||
)
|
||||
.w_h(18.0, 18.0)
|
||||
.down_from(state.ids.mouse_zoom_slider, 20.0)
|
||||
.hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
|
||||
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
|
||||
.set(state.ids.mouse_zoom_invert_button, ui);
|
||||
|
||||
if self.global_state.settings.gameplay.zoom_inversion != zoom_inverted {
|
||||
events.push(Event::ToggleZoomInvert(!self.global_state.settings.gameplay.zoom_inversion));
|
||||
}
|
||||
|
||||
Text::new("Invert Scroll Zoom")
|
||||
.right_from(state.ids.mouse_zoom_invert_button, 10.0)
|
||||
.font_size(14)
|
||||
.font_id(self.fonts.opensans)
|
||||
.graphics_for(state.ids.button_help)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.mouse_zoom_invert_label, ui);
|
||||
}
|
||||
|
||||
// 3) Controls Tab --------------------------------
|
||||
|
@ -392,6 +392,11 @@ impl PlayState for SessionState {
|
||||
global_state.settings.gameplay.zoom_sensitivity = sensitivity;
|
||||
global_state.settings.save_to_file_warn();
|
||||
}
|
||||
HudEvent::ToggleZoomInvert(zoom_inverted) => {
|
||||
global_state.window.zoom_inversion = zoom_inverted;
|
||||
global_state.settings.gameplay.zoom_inversion = zoom_inverted;
|
||||
global_state.settings.save_to_file_warn();
|
||||
}
|
||||
HudEvent::AdjustViewDistance(view_distance) => {
|
||||
self.client.borrow_mut().set_view_distance(view_distance);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user