From f164679649c620185002d21da6507432eea4aa86 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 15:29:37 +0200 Subject: [PATCH] ui scaling relative to window size --- voxygen/src/hud/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 3002281939..f8d6d81e61 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -10,7 +10,6 @@ mod settings_window; mod skillbar; mod small_window; -use crate::hud::Event::CrosshairTransp; use bag::Bag; use buttons::Buttons; use character_window::CharacterWindow; @@ -124,6 +123,7 @@ pub enum Event { ChangeAudioDevice(String), ChangeMaxFPS(u32), CrosshairTransp(f32), + //UiScale(f32), CharacterSelection, Logout, Quit, @@ -271,7 +271,10 @@ impl Hud { pub fn new(window: &mut Window) -> Self { let mut ui = Ui::new(window).unwrap(); // TODO: Adjust/remove this, right now it is used to demonstrate window scaling functionality. - ui.scaling_mode(ScaleMode::RelativeToWindow([1920.0, 1080.0].into())); + let ui_scale = 0.7; + ui.scaling_mode(ScaleMode::RelativeToWindow( + window.renderer().get_resolution().map(|e| e as f64) / ui_scale as f64, + )); // Generate ids. let ids = Ids::new(ui.id_generator()); // Load images. @@ -284,6 +287,7 @@ impl Hud { imgs, fonts, ids, + ui_scale, new_messages: VecDeque::new(), inventory_space: 8, show: Show {