This commit is contained in:
griffi-gh 2024-02-26 01:20:52 +01:00
parent 20f89a7567
commit 0a7392684a
2 changed files with 6 additions and 4 deletions

View file

@ -42,11 +42,13 @@ fn main() {
hui.add({ hui.add({
Container::default() Container::default()
.with_size((UiSize::Fraction(1.), UiSize::Fraction(1.)))
.with_padding(Sides::all(5.)) .with_padding(Sides::all(5.))
.with_children(|ui: &mut ElementList| { .with_children(|ui: &mut ElementList| {
Text::default() Text::default()
.with_text("Hello, world") .with_text("Hello, world")
.with_text_size(12) .with_text_size(120)
.with_color(vec4(0., 0., 0., 1.))
.add_to(ui); .add_to(ui);
}) })
}, resolution); }, resolution);

View file

@ -84,11 +84,11 @@ impl From<Vec<Box<dyn UiElement>>> for ElementList {
} }
pub trait UiElementListExt { pub trait UiElementListExt {
fn add_to(self, list: &mut ElementList); fn add_to(self, ui: &mut ElementList);
} }
impl<T: UiElement + 'static> UiElementListExt for T { impl<T: UiElement + 'static> UiElementListExt for T {
fn add_to(self, list: &mut ElementList) { fn add_to(self, ui: &mut ElementList) {
list.add(self) ui.add(self)
} }
} }