succesfull rendering of multi-level rects and texts

This commit is contained in:
Anton-4 2022-02-12 11:55:29 +01:00
parent 51d86f101f
commit 59a0c47038
No known key found for this signature in database
GPG key ID: C954D6E0F9C0ABFD
3 changed files with 96 additions and 41 deletions

View file

@ -1,4 +1,3 @@
use crate::graphics::primitives::rect::Rect;
use crate::graphics::primitives::text::{owned_section_from_text, Text};
@ -20,6 +19,15 @@ impl RectsAndTexts {
}
}
pub fn init(rects_behind: Vec<Rect>, texts_behind: Vec<Text>, rects_front: Vec<Rect>, texts_front: Vec<Text>) -> Self {
Self {
text_sections_behind: texts_behind.iter().map(|txt| owned_section_from_text(txt)).collect(),
text_sections_front: texts_front.iter().map(|txt| owned_section_from_text(txt)).collect(),
rects_behind,
rects_front,
}
}
pub fn add_text_behind(&mut self, new_text_section: glyph_brush::OwnedSection) {
self.text_sections_behind.push(new_text_section);
}
@ -48,4 +56,4 @@ impl RectsAndTexts {
self.rects_behind.extend(rects_and_texts.rects_behind);
self.rects_front.extend(rects_and_texts.rects_front);
}
}
}