2024-03-24 16:18:15 -05:00
|
|
|
use std::time::Instant;
|
|
|
|
use hui::{
|
|
|
|
color, element::{
|
|
|
|
container::Container,
|
|
|
|
fill_rect::FillRect,
|
|
|
|
UiElementExt
|
|
|
|
}, frame_rect, layout::{Alignment, Direction}, size
|
|
|
|
};
|
|
|
|
|
|
|
|
#[path = "../boilerplate.rs"]
|
|
|
|
#[macro_use]
|
|
|
|
mod boilerplate;
|
|
|
|
|
|
|
|
ui_main!(
|
|
|
|
"hUI: 9-Patch demo",
|
|
|
|
init: |_| {
|
2024-03-24 16:55:15 -05:00
|
|
|
|
2024-03-24 16:18:15 -05:00
|
|
|
},
|
2024-03-24 16:55:15 -05:00
|
|
|
run: |ui, size, _| {
|
2024-03-24 16:18:15 -05:00
|
|
|
Container::default()
|
2024-03-24 16:55:15 -05:00
|
|
|
.with_size(size!(100%))
|
2024-03-24 16:18:15 -05:00
|
|
|
.with_align(Alignment::Center)
|
|
|
|
.with_background(color::WHITE)
|
|
|
|
.with_children(|ui| {
|
|
|
|
FillRect::default()
|
|
|
|
.with_size(size!(300, 100))
|
|
|
|
.with_frame(frame_rect! {
|
2024-03-24 16:55:15 -05:00
|
|
|
color: color::RED
|
2024-03-24 16:18:15 -05:00
|
|
|
})
|
|
|
|
.add_child(ui);
|
|
|
|
})
|
|
|
|
.add_root(ui, size);
|
|
|
|
}
|
|
|
|
);
|