update rounded example

This commit is contained in:
griffi-gh 2024-02-19 14:01:51 +01:00
parent da58e8112f
commit 73316e630d

View file

@ -5,10 +5,11 @@ use winit::{
event_loop::{EventLoopBuilder, ControlFlow} event_loop::{EventLoopBuilder, ControlFlow}
}; };
use hui::{ use hui::{
UiDirection, UiInstance, UiSize,
element::{ element::{
container::{Alignment, Container, Sides}, container::{Alignment, Container, Sides},
text::Text text::Text
}, UiInstance, UiSize },
}; };
use hui_glium::GliumUiRenderer; use hui_glium::GliumUiRenderer;
@ -40,11 +41,12 @@ fn main() {
elements: vec![Box::new(Container { elements: vec![Box::new(Container {
align: (Alignment::Center, Alignment::Center), align: (Alignment::Center, Alignment::Center),
size: (UiSize::Fraction(0.5), UiSize::Fraction(0.5)), size: (UiSize::Fraction(0.5), UiSize::Fraction(0.5)),
background: Some(vec4(1., 0.1, 0.1, 1.)), background: Some(vec4(1., 0., 0., 1.)),
corner_radius: Some(30.), corner_radius: Some(30.),
elements: vec![ elements: vec![
Box::new(Container { Box::new(Container {
padding: Sides::all(20.), padding: Sides::all(20.),
direction: UiDirection::Horizontal,
align: (Alignment::Center, Alignment::Center), align: (Alignment::Center, Alignment::Center),
size: (UiSize::Auto, UiSize::Auto), size: (UiSize::Auto, UiSize::Auto),
background: Some(vec4(0.1, 0.1, 0.1, 0.5)), background: Some(vec4(0.1, 0.1, 0.1, 0.5)),
@ -56,6 +58,12 @@ fn main() {
color: vec4(1., 1., 1., 1.), color: vec4(1., 1., 1., 1.),
..Default::default() ..Default::default()
}), }),
Box::new(Text {
text: "!".into(),
text_size: 50,
color: vec4(1., 1., 0., 1.),
..Default::default()
}),
], ],
..Default::default() ..Default::default()
}), }),