Run Iris examples on desktop and Android
This commit is contained in:
1 parent
37f956707e
commit
b5666cdef9
25 files changed
+577
-205
No files matched your search
@@ -0,0 +1,21 @@
|
||||
use iris::prelude::*;
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) fn build<Rsc: HasEvents + HasTasks>(rsc: &mut Rsc, ui_state: &mut impl HasRoot<Rsc>)
|
||||
where
|
||||
Rsc::State: FocusHost,
|
||||
{
|
||||
let rect = rect(PaintId::RED).add(rsc);
|
||||
rect.task_on(CursorSense::click(), async move |mut ctx| {
|
||||
iris::task::sleep(Duration::from_secs(1)).await;
|
||||
ctx.update(move |_, rsc| {
|
||||
let rect = rect(rsc);
|
||||
if rect.is_paint(&PaintId::RED) {
|
||||
rect.set_paint(PaintId::BLUE);
|
||||
} else {
|
||||
rect.set_paint(PaintId::RED);
|
||||
}
|
||||
});
|
||||
})
|
||||
.set_root(rsc, ui_state);
|
||||
}
|
||||
Reference in new issue
Block a user