show recommended scale factor in options [rebuild]

This commit is contained in:
Dustin Carlino 2020-03-18 10:22:39 -07:00
parent ad4ebeeb61
commit 01b5617840
5 changed files with 22 additions and 3 deletions

View File

@ -261,4 +261,8 @@ impl PrerenderInnards {
}
pub fn window_resized(&self, _: f64, _: f64) {}
pub fn monitor_scale_factor(&self) -> f64 {
self.display.gl_window().window().scale_factor()
}
}

View File

@ -313,4 +313,8 @@ impl PrerenderInnards {
self.gl.scissor(0, 0, width as i32, height as i32);
}
}
pub fn monitor_scale_factor(&self) -> f64 {
self.windowed_context.window().scale_factor()
}
}

View File

@ -328,4 +328,8 @@ impl PrerenderInnards {
self.gl.scissor(0, 0, width as i32, height as i32);
}
}
pub fn monitor_scale_factor(&self) -> f64 {
self.window.scale_factor()
}
}

View File

@ -96,6 +96,10 @@ impl<'a> EventCtx<'a> {
pub fn get_scale_factor(&self) -> f64 {
*self.prerender.assets.scale_factor.borrow()
}
pub fn monitor_scale_factor(&self) -> f64 {
self.prerender.inner.monitor_scale_factor()
}
}
pub struct LoadingScreen<'a> {

View File

@ -118,9 +118,12 @@ impl OptionsPanel {
.margin(5),
]),
ManagedWidget::row(vec![
"Scale factor for text / UI elements:"
.draw_text(ctx)
.margin(5),
format!(
"Scale factor for text / UI elements (your monitor is {}):",
ctx.monitor_scale_factor()
)
.draw_text(ctx)
.margin(5),
WrappedComposite::nice_text_button(
ctx,
Text::from(Line(format!("{}", ctx.get_scale_factor()))),