fixed text box size for loading screens

This commit is contained in:
Dustin Carlino 2019-08-02 16:52:49 +02:00
parent 1412a888d6
commit f8cee896bf
2 changed files with 6 additions and 1 deletions

View File

@ -200,6 +200,8 @@ impl<'a> LoadingScreen<'a> {
self.last_drawn = Some(Instant::now());
let mut txt = Text::prompt(&self.title);
txt.override_width = Some(self.canvas.window_width * 0.8);
txt.override_height = Some(self.canvas.window_height * 0.8);
for l in &self.lines {
txt.add_line(l.to_string());
}

View File

@ -43,6 +43,7 @@ pub struct Text {
lines: Vec<(Option<Color>, Vec<TextSpan>)>,
bg_color: Option<Color>,
pub(crate) override_width: Option<f64>,
pub(crate) override_height: Option<f64>,
}
impl Text {
@ -51,6 +52,7 @@ impl Text {
lines: Vec::new(),
bg_color: Some(BG_COLOR),
override_width: None,
override_height: None,
}
}
@ -65,6 +67,7 @@ impl Text {
lines: Vec::new(),
bg_color,
override_width: None,
override_height: None,
}
}
@ -178,7 +181,7 @@ impl Text {
}
(
self.override_width.unwrap_or_else(|| f64::from(max_width)),
height,
self.override_height.unwrap_or_else(|| f64::from(height)),
)
}
}