use crate::*; /// The `Tui` struct (the *engine*) implements the /// `tengri_input::Input` and `tengri_output::Out` traits. /// At launch, the `Tui` engine spawns two threads, the render thread and the input thread. /// the application may further spawn other threads. All threads communicate using shared ownership: /// `Arc>` and `Arc`. Thus, at launch the engine and application instances are expected to be wrapped in `Arc`. pub struct Tui { pub exited: Arc, pub backend: CrosstermBackend, pub buffer: Buffer, pub area: [u16;4], pub perf: PerfModel, } #[derive(Debug, Clone)] pub struct TuiIn { /// Input event pub event: TuiEvent, /// Exit flag pub exited: Arc, } #[derive(Debug, Clone, Eq, PartialEq, PartialOrd)] pub struct TuiEvent(pub Event); #[derive(Debug, Clone, Eq, PartialEq, PartialOrd)] pub struct TuiKey( pub Option, pub KeyModifiers ); #[derive(Default)] pub struct TuiOut { pub buffer: Buffer, pub area: XYWH, } /// TUI buffer sized by `usize` instead of `u16`. #[derive(Default)] pub struct BigBuffer { pub width: usize, pub height: usize, pub content: Vec } /// A color in OKHSL and RGB representations. #[derive(Debug, Default, Copy, Clone, PartialEq)] pub struct ItemColor { pub okhsl: Okhsl, pub rgb: Color, } /// A color in OKHSL and RGB with lighter and darker variants. #[derive(Debug, Default, Copy, Clone, PartialEq)] pub struct ItemTheme { pub base: ItemColor, pub light: ItemColor, pub lighter: ItemColor, pub lightest: ItemColor, pub dark: ItemColor, pub darker: ItemColor, pub darkest: ItemColor, } pub struct Modify(pub bool, pub Modifier, pub T); pub struct Styled(pub Option