Skip to main content

terminal_graphics_interactive/
lib.rs

1//! Keyboard and mouse input for [`terminal_graphics`].
2#![deny(unsafe_code)]
3#![warn(missing_docs)]
4
5mod art;
6mod clock;
7mod event;
8pub mod game;
9mod input;
10mod parser;
11mod raw_mode;
12mod renderer;
13mod terminal;
14
15pub use art::{sketch, sketch_frame, sketch_with, Cell, Palette, Pointer, Simulation, World};
16pub use event::{Event, Key, KeyCode, Modifiers, Mouse, MouseButton, MouseKind};
17pub use parser::Parser;
18pub use raw_mode::{RawMode, MOUSE_OFF, MOUSE_ON};
19pub use renderer::Renderer;
20pub use terminal::Terminal;
21pub use terminal_graphics::*;
22
23/// Everything in one import: `use terminal_graphics_interactive::prelude::*;`
24///
25/// This is the `terminal_graphics` prelude (`Display`, `Colour`, `Graphics`,
26/// `Rect`, `Ball`, `Text`, `Container`, ...) plus the interactive types
27/// (`Terminal`, `Event`, `Key`, `KeyCode`, `Mouse`, `MouseKind`, ...).
28///
29/// ```
30/// use terminal_graphics_interactive::prelude::*;
31///
32/// let mut display = Display::new(10, 3);
33/// display.set_pixel(1, 1, '#', Colour::Red, Colour::Black);
34/// assert!(Key::new(KeyCode::Char('q')).is_char('q'));
35/// ```
36pub mod prelude {
37    pub use crate::{
38        sketch, sketch_frame, sketch_with, Cell, Event, Key, KeyCode, Modifiers, Mouse,
39        MouseButton, MouseKind, Palette, Parser, Pointer, RawMode, Simulation, Terminal, World,
40    };
41    pub use terminal_graphics::prelude::*;
42}