1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//! //! ## Tuikit //! Tuikit is a TUI library for writing terminal UI applications. Highlights: //! //! - Thread safe. //! - Support non-fullscreen mode as well as fullscreen mode. //! - Support `Alt` keys, mouse events, etc. //! - Buffering for efficient rendering. //! //! Tuikit is modeld after [termbox](https://github.com/nsf/termbox) which views the //! terminal as a table of fixed-size cells and input being a stream of structured //! messages. //! //! ## Usage //! //! In your `Cargo.toml` add the following: //! //! ```toml //! [dependencies] //! tuikit = "*" //! ``` //! //! Here is an example: //! //! ```no_run //! use tuikit::attr::*; //! use tuikit::term::{Term, TermHeight}; //! use tuikit::event::{Event, Key}; //! use std::cmp::{min, max}; //! //! fn main() { //! let term = Term::with_height(TermHeight::Percent(30)).unwrap(); //! let mut row = 1; //! let mut col = 0; //! //! let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit"); //! let _ = term.present(); //! //! while let Ok(ev) = term.poll_event() { //! let _ = term.clear(); //! let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit"); //! //! let (width, height) = term.term_size().unwrap(); //! match ev { //! Event::Key(Key::ESC) | Event::Key(Key::Char('q')) => break, //! Event::Key(Key::Up) => row = max(row-1, 1), //! Event::Key(Key::Down) => row = min(row+1, height-1), //! Event::Key(Key::Left) => col = max(col, 1)-1, //! Event::Key(Key::Right) => col = min(col+1, width-1), //! _ => {} //! } //! //! let attr = Attr{ fg: Color::RED, ..Attr::default() }; //! let _ = term.print_with_attr(row, col, "Hello World! 你好!今日は。", attr); //! let _ = term.set_cursor(row, col); //! let _ = term.present(); //! } //! } //! ``` pub mod attr; pub mod canvas; pub mod cell; mod color; pub mod container; pub mod draw; pub mod event; pub mod input; pub mod key; pub mod output; pub mod prelude; pub mod raw; pub mod screen; mod spinlock; mod sys; pub mod term;