mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-09 17:38:42 -06:00
44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
use hui::{
|
|
color, size, frame_rect,
|
|
element::{container::Container, text::Text, UiElementExt},
|
|
frame::FrameRect,
|
|
layout::Alignment,
|
|
};
|
|
|
|
#[path = "../boilerplate.rs"]
|
|
#[macro_use]
|
|
mod boilerplate;
|
|
|
|
ui_main!(|ui, size, _| {
|
|
Container::default()
|
|
.with_size(size!(100%, 50%))
|
|
.with_align(Alignment::Center)
|
|
.with_padding(5.)
|
|
.with_gap(10.)
|
|
.with_background(frame_rect! {
|
|
color: (0.5, 0.5, 0.5, 1.),
|
|
corner_radius: 10.,
|
|
})
|
|
.with_children(|ui| {
|
|
Text::default()
|
|
.with_text("Hello, world")
|
|
.with_text_size(100)
|
|
.with_color(color::BLACK)
|
|
.add_child(ui);
|
|
Container::default()
|
|
.with_padding((10., 20.))
|
|
.with_background(frame_rect! {
|
|
color: color::DARK_RED,
|
|
corner_radius: (2.5, 30., 2.5, 2.5),
|
|
})
|
|
.with_children(|ui| {
|
|
Text::default()
|
|
.with_text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
|
|
.with_text_size(24)
|
|
.add_child(ui);
|
|
})
|
|
.add_child(ui);
|
|
})
|
|
.add_root(ui, size);
|
|
});
|