changed main code
This commit is contained in:
+5
-20
@@ -4,31 +4,16 @@ fn main() -> std::io::Result<()> {
|
|||||||
let screen = Screen::new();
|
let screen = Screen::new();
|
||||||
let count = use_state(0);
|
let count = use_state(0);
|
||||||
|
|
||||||
std::thread::spawn({
|
|
||||||
let count = count.clone();
|
|
||||||
move || loop {
|
|
||||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
|
||||||
**count.get() += 1;
|
|
||||||
count.update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// let mut r = Rsx(Vec::new());
|
|
||||||
// r.create_element(
|
|
||||||
// {
|
|
||||||
// let count = count.clone();
|
|
||||||
// move || WidgetLoad::new(format!("{count}"))
|
|
||||||
// },
|
|
||||||
// vec![Box::new(count)],
|
|
||||||
// );
|
|
||||||
|
|
||||||
// r.draw(&screen);
|
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
%count
|
%count
|
||||||
"{count}"
|
"{count}"
|
||||||
}
|
}
|
||||||
.draw(&screen);
|
.draw(&screen);
|
||||||
|
|
||||||
|
std::thread::spawn(move || loop {
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||||
|
**count.get() += 1;
|
||||||
|
});
|
||||||
|
|
||||||
screen.run()
|
screen.run()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user