From e15c4eb40b601cd1194be775e806dfda31602a6e Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Fri, 26 Jul 2019 23:05:39 +0200 Subject: [PATCH] changed displayed value for scale --- voxygen/src/hud/mod.rs | 15 ++++++-- voxygen/src/hud/settings_window.rs | 59 +++++++++++++----------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 19f13b5401..b4b58c1937 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -281,7 +281,7 @@ pub struct Hud { inventory_space: usize, show: Show, to_focus: Option>, - force_ungrab: bool, + force_ungrab: bool, force_chat_input: Option, force_chat_cursor: Option, } @@ -304,7 +304,7 @@ impl Hud { ui, imgs, fonts, - ids, + ids, new_messages: VecDeque::new(), inventory_space: 8, show: Show { @@ -638,8 +638,15 @@ impl Hud { // Settings if let Windows::Settings = self.show.open_windows { - for event in SettingsWindow::new(&global_state, &self.show, &self.imgs, &self.fonts, self.show.rel_to_win, self.show.absolute) - .set(self.ids.settings_window, ui_widgets) + for event in SettingsWindow::new( + &global_state, + &self.show, + &self.imgs, + &self.fonts, + self.show.rel_to_win, + self.show.absolute, + ) + .set(self.ids.settings_window, ui_widgets) { match event { settings_window::Event::ToggleHelp => self.show.toggle_help(), diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 0c350563ea..54e22e16e8 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -97,7 +97,7 @@ pub struct SettingsWindow<'a> { show: &'a Show, imgs: &'a Imgs, - fonts: &'a Fonts, + fonts: &'a Fonts, #[conrod(common_builder)] common: widget::CommonBuilder, @@ -117,7 +117,7 @@ impl<'a> SettingsWindow<'a> { show, imgs, fonts, - common: widget::CommonBuilder::default(), + common: widget::CommonBuilder::default(), } } } @@ -243,8 +243,7 @@ impl<'a> Widget for SettingsWindow<'a> { if let SettingsTab::Interface = self.show.settings_tab { let crosshair_transp = self.global_state.settings.gameplay.crosshair_transp; let crosshair_type = self.global_state.settings.gameplay.crosshair_type; - let ui_scale = self.global_state.settings.gameplay.ui_scale; - + let ui_scale = self.global_state.settings.gameplay.ui_scale; Text::new("General") .top_left_with_margins_on(state.ids.settings_content, 5.0, 5.0) @@ -350,42 +349,37 @@ impl<'a> Widget for SettingsWindow<'a> { events.push(Event::UiScale(ScaleChange::ToAbsolute)) } } - }*/ - - + }*/ /* Intended function: Checking one button unchecks the other one Buttons can't be unchecked by clicking them Slider switches to active state (display of indicator and value) when absolute scaling is checked */ - - - let mut scaling_method = ScaleChange::ToRelative; // Relative Scaling Button - - if Button::image(match ui_scale { + + if Button::image(match ui_scale { ScaleMode::Absolute(_) => self.imgs.check, ScaleMode::RelativeToWindow(_) => self.imgs.check_checked, ScaleMode::DpiFactor => self.imgs.check_checked, - }) + }) .w_h(288.0 / 24.0, 288.0 / 24.0) .down_from(state.ids.ui_scale_label, 20.0) - .hover_image(match ui_scale { + .hover_image(match ui_scale { ScaleMode::Absolute(_) => self.imgs.check_mo, ScaleMode::RelativeToWindow(_) => self.imgs.check_checked, ScaleMode::DpiFactor => self.imgs.check_checked, - }) - .press_image(match ui_scale { + }) + .press_image(match ui_scale { ScaleMode::Absolute(_) => self.imgs.check_press, ScaleMode::RelativeToWindow(_) => self.imgs.check_checked, ScaleMode::DpiFactor => self.imgs.check_checked, - }) + }) .set(state.ids.relative_to_win_button, ui) .was_clicked() { - events.push(Event::UiScale(ScaleChange::ToRelative)); + events.push(Event::UiScale(ScaleChange::ToRelative)); } Text::new("Relative Scaling") @@ -396,30 +390,29 @@ impl<'a> Widget for SettingsWindow<'a> { .color(TEXT_COLOR) .set(state.ids.relative_to_win_text, ui); - // Absolute Scaling Button - if Button::image(match ui_scale { + if Button::image(match ui_scale { ScaleMode::Absolute(_) => self.imgs.check_checked, ScaleMode::RelativeToWindow(_) => self.imgs.check, ScaleMode::DpiFactor => self.imgs.check, - }) + }) .w_h(288.0 / 24.0, 288.0 / 24.0) .down_from(state.ids.relative_to_win_button, 20.0) - .hover_image(match ui_scale { + .hover_image(match ui_scale { ScaleMode::Absolute(_) => self.imgs.check_checked, ScaleMode::RelativeToWindow(_) => self.imgs.check_mo, ScaleMode::DpiFactor => self.imgs.check_mo, - }) - .press_image(match ui_scale { + }) + .press_image(match ui_scale { ScaleMode::Absolute(_) => self.imgs.check_checked, ScaleMode::RelativeToWindow(_) => self.imgs.check_press, ScaleMode::DpiFactor => self.imgs.check_press, - }) + }) .set(state.ids.absolute_scale_button, ui) .was_clicked() { - events.push(Event::UiScale(ScaleChange::ToAbsolute)); + events.push(Event::UiScale(ScaleChange::ToAbsolute)); } Text::new("Custom Scaling") @@ -448,16 +441,16 @@ impl<'a> Widget for SettingsWindow<'a> { { events.push(Event::UiScale(ScaleChange::Adjust(2.0f64.powf(new_val)))); } - Text::new(&format!("{:?}", ui_scale)) - .right_from(state.ids.ui_scale_slider, 8.0) - .font_size(14) - .font_id(self.fonts.opensans) - .color(TEXT_COLOR) - .set(state.ids.ui_scale_value, ui); + Text::new(&format!("{:.2}", scale)) + .right_from(state.ids.ui_scale_slider, 8.0) + .font_size(14) + .font_id(self.fonts.opensans) + .color(TEXT_COLOR) + .set(state.ids.ui_scale_value, ui); } else { if let Some(_val) = ImageSlider::continuous(5.0, 0.0, 10.0, self.imgs.nothing, self.imgs.slider) - .w_h(208.0, 22.0) + .w_h(210.0, 22.0) .right_from(state.ids.absolute_scale_text, 10.0) .track_breadth(12.0) .slider_length(10.0)