hUI/hui-examples/examples/ui_test_wrapping.rs

39 lines
873 B
Rust
Raw Normal View History

2024-03-06 08:44:02 -06:00
use hui::{
2024-03-06 10:00:18 -06:00
color, size,
layout::UiDirection,
element::{
2024-03-06 08:44:02 -06:00
container::Container,
fill_rect::FillRect,
text::Text,
UiElementExt
2024-03-06 10:00:18 -06:00
},
2024-03-06 08:44:02 -06:00
};
#[path = "../boilerplate.rs"]
#[macro_use]
mod boilerplate;
ui_main!(|ui, size, _| {
Container::default()
.with_size(size!(100%))
.with_direction(UiDirection::Horizontal)
.with_padding(5.)
.with_gap(10.)
.with_background(color::WHITE)
2024-03-06 10:00:18 -06:00
.with_wrap(true)
2024-03-06 08:44:02 -06:00
.with_children(|ui| {
Text::default()
.with_color(color::BLACK)
.with_text("wrapping is not actually implemented yet")
.add_child(ui);
for _ in 0..10 {
FillRect::default()
.with_size(size!(100))
.with_corner_radius(8.)
.with_background(color::DARK_RED)
.add_child(ui);
}
})
.add_root(ui, size);
});