Update display label in demo app
This commit is contained in:
parent
bd91097ecd
commit
7bf1ac0cae
1 changed files with 10 additions and 4 deletions
|
@ -103,8 +103,9 @@ fn main() -> Result<(), String> {
|
|||
power.set_align(&mut screen, lvgl::Align::InTopRight, 0, 0);
|
||||
|
||||
let mut event_pump = sdl_context.event_pump()?;
|
||||
let mut i = 0;
|
||||
'running: loop {
|
||||
for event in event_pump.poll_iter() {
|
||||
if let Some(event) = event_pump.poll_event() {
|
||||
match event {
|
||||
Event::Quit { .. }
|
||||
| Event::KeyDown {
|
||||
|
@ -117,12 +118,17 @@ fn main() -> Result<(), String> {
|
|||
}
|
||||
}
|
||||
|
||||
::std::thread::sleep(Duration::from_millis(
|
||||
lvgl_sys::LV_DISP_DEF_REFR_PERIOD as u64,
|
||||
));
|
||||
if i > 59 {
|
||||
i = 0;
|
||||
}
|
||||
time.set_text(format!("21:{:02}\0", i).as_str());
|
||||
i = 1 + i;
|
||||
|
||||
::std::thread::sleep(Duration::from_millis(10));
|
||||
|
||||
unsafe {
|
||||
lvgl_sys::lv_task_handler();
|
||||
lvgl_sys::lv_tick_inc(10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue