mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
fixed text box size for loading screens
This commit is contained in:
parent
1412a888d6
commit
f8cee896bf
@ -200,6 +200,8 @@ impl<'a> LoadingScreen<'a> {
|
|||||||
self.last_drawn = Some(Instant::now());
|
self.last_drawn = Some(Instant::now());
|
||||||
|
|
||||||
let mut txt = Text::prompt(&self.title);
|
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 {
|
for l in &self.lines {
|
||||||
txt.add_line(l.to_string());
|
txt.add_line(l.to_string());
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ pub struct Text {
|
|||||||
lines: Vec<(Option<Color>, Vec<TextSpan>)>,
|
lines: Vec<(Option<Color>, Vec<TextSpan>)>,
|
||||||
bg_color: Option<Color>,
|
bg_color: Option<Color>,
|
||||||
pub(crate) override_width: Option<f64>,
|
pub(crate) override_width: Option<f64>,
|
||||||
|
pub(crate) override_height: Option<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Text {
|
impl Text {
|
||||||
@ -51,6 +52,7 @@ impl Text {
|
|||||||
lines: Vec::new(),
|
lines: Vec::new(),
|
||||||
bg_color: Some(BG_COLOR),
|
bg_color: Some(BG_COLOR),
|
||||||
override_width: None,
|
override_width: None,
|
||||||
|
override_height: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +67,7 @@ impl Text {
|
|||||||
lines: Vec::new(),
|
lines: Vec::new(),
|
||||||
bg_color,
|
bg_color,
|
||||||
override_width: None,
|
override_width: None,
|
||||||
|
override_height: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +181,7 @@ impl Text {
|
|||||||
}
|
}
|
||||||
(
|
(
|
||||||
self.override_width.unwrap_or_else(|| f64::from(max_width)),
|
self.override_width.unwrap_or_else(|| f64::from(max_width)),
|
||||||
height,
|
self.override_height.unwrap_or_else(|| f64::from(height)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user