//! Mode 00: Direct draw, direct control use ::tengri::{ *, dizzle::*, crossterm::event::{KeyEvent, Event::*, KeyCode::*}, ratatui::style::Color, }; tui_app!(State { /** User-controllable value. */ counter: usize, }); tui_view!(self: State { draw(|to: &mut Tui|{ let _ = "Demo [Mode 00]".align_sw().draw(to); let _ = ShowSize.align_se().draw(to); let _ = format!("Counter:\n{}", self.counter).align_c().draw(to); Ok(Some(to.area())) }) }); tui_keys!(self: State, input { Ok(if let Key(KeyEvent { code, .. }) = input.0 { match code { Up | Right => { self.counter = (self.counter + 1) % 10; () }, Down | Left => { self.counter = if self.counter > 0 { self.counter - 1 } else { 10 - 1 }; () }, _ => {} } }) });