1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-22 05:33:02 +00:00

fix text wrapping on no data scene

This commit is contained in:
József Sallai 2023-01-22 19:42:40 +02:00
parent 334e64f499
commit cb95db1e89

View file

@ -100,10 +100,14 @@ impl Scene for NoDataScene {
let mut line = String::new();
for word in self.err.split(' ') {
if line.len() + word.len() > 80 {
let combined_word = line.clone() + " " + word;
let line_length = state.font.compute_width(&mut combined_word.chars(), None);
if line_length > state.canvas_size.0 as f32 {
lines.push(line);
line = String::new();
}
line.push_str(word);
line.push(' ');
}