Simple demos #15

This commit is contained in:
2025-08-02 06:02:54 -05:00
parent 48849c7cc2
commit 0ccf03de3b
+28 -1
View File
@@ -1,7 +1,34 @@
use osui::prelude::*; use osui::prelude::*;
pub fn app() -> Rsx { pub fn app() -> Rsx {
let count = use_state(0);
std::thread::spawn({
let count = count.clone();
move || loop {
**count.get() += 1;
std::thread::sleep(std::time::Duration::from_secs(1));
}
});
rsx! { rsx! {
"Hello, World" FlexRow {
FlexCol {
@Transform::new().padding(2, 2);
@Style { foreground: None, background: Background::RoundedOutline(0x00ff00) }; // TODO: Outline doesn't work
Div {
"This is text inside a div"
}
// TODO: div with width full
} (2)
FlexCol {
Div {
%count
"This will increment every second: {count}"
}
} (2)
} (0)
} }
} }