mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-09 17:38:42 -06:00
39 lines
860 B
Rust
39 lines
860 B
Rust
|
use std::time::Instant;
|
||
|
use hui::{
|
||
|
color, size,
|
||
|
layout::{Alignment, Direction},
|
||
|
element::{
|
||
|
container::Container,
|
||
|
fill_rect::FillRect,
|
||
|
interactable::ElementInteractableExt,
|
||
|
UiElementExt
|
||
|
},
|
||
|
};
|
||
|
|
||
|
#[path = "../boilerplate.rs"]
|
||
|
#[macro_use]
|
||
|
mod boilerplate;
|
||
|
|
||
|
ui_main!(
|
||
|
"hUI: Internal input test",
|
||
|
init: |_| {},
|
||
|
run: |ui, size, _| {
|
||
|
Container::default()
|
||
|
.with_size(size!(100%))
|
||
|
.with_align(Alignment::Center)
|
||
|
.with_background(color::WHITE)
|
||
|
.with_children(|ui| {
|
||
|
FillRect::default()
|
||
|
.with_size(size!(40))
|
||
|
.with_corner_radius(8.)
|
||
|
.with_background(color::DARK_RED)
|
||
|
.into_interactable()
|
||
|
.on_click(|| {
|
||
|
println!("clicked");
|
||
|
})
|
||
|
.add_child(ui);
|
||
|
})
|
||
|
.add_root(ui, size);
|
||
|
}
|
||
|
);
|