Simple demos #15
This commit is contained in:
+28
-1
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user