This commit is contained in:
facile pop culture reference 2026-07-31 06:47:30 +03:00
parent 94c26f06cc
commit fc01fd6ad3
40 changed files with 2075 additions and 1807 deletions

View file

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