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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! retroglyph-core: the `no_std`-compatible foundation of retroglyph.
//!
//! Grid, tile, style, color, text, terminal, and event types, plus the
//! [`Output`]/[`Input`]/[`Cursor`] backend facets (bundled together as [`Backend`]) and the
//! dependency-free [`Headless`] test backend, and the `App`/`Flow`/`Frame` game loop contract.
//! Platform backends (`retroglyph-crossterm`, `retroglyph-software`) and drawing helpers
//! (`retroglyph-widgets`) are separate crates that depend on this one.
//!
//! # Architecture
//!
//! [`Terminal<B>`](Terminal) owns a double-buffered [`Grid`] and the [`Backend`] lifecycle
//! (resize, present, events). Drawing itself goes entirely through [`Surface`], handed out by
//! [`Terminal::draw`]/[`Terminal::surface`]: a game calls `term.draw(|s| { s.put(...); ... })`
//! once per frame, and [`present`](Terminal::present) diffs the current frame against the
//! previous one, sending only changed cells to the [`Backend`]. `B` is the only thing that
//! changes between a headless test and a real window or terminal:
//!
//! ```text
//! ┌───────────────────────────┐
//! │ App::update(...) │ game logic, once, generic over B
//! └──────────────┬─────────────┘
//! │ term.draw(|s| ...): writes through Surface
//! ▼
//! ┌───────────────────────────┐
//! │ Terminal<B> │ double-buffered Grid, cell diff
//! └──────────────┬─────────────┘
//! │ draw / draw_layers / poll_event
//! ▼
//! ┌───────────────────────────┐
//! │ B: Output + Input + Cursor │ the only piece that swaps out
//! └──────────────┬─────────────┘
//! │
//! ┌─────────────────────┼─────────────────────┐
//! ▼ ▼ ▼
//! Headless (here) Crossterm SoftwareRenderer
//! in-memory grid, (retroglyph-crossterm) (retroglyph-software)
//! synthetic events real TTY, ANSI output winit window, pixels
//! ```
//!
//! [`Headless`] stores presented content in memory and lets tests inject
//! synthetic [`Event`]s with [`Headless::push_event`](backend::Headless::push_event);
//! nothing here talks to a real terminal or window. Swapping `Headless` for
//! `Crossterm` or `SoftwareRenderer` changes only the `B` type parameter --
//! `App` implementations, [`Terminal`] calls, and game logic are unchanged.
//! `run_blocking` drives `Terminal<Headless>` and `Terminal<Crossterm>`
//! identically; the software backend's windowed loop drives `Terminal<SoftwareRenderer>`
//! through the same [`App`]/[`step`] contract, inverted because winit owns the
//! event loop instead of handing control back to a driver function.
//!
//! See `examples/headless.rs` (`cargo run -p retroglyph-core --example
//! headless`) for the smallest possible use of [`Headless`], depending on
//! nothing but this crate.
extern crate alloc;
// Compile the code blocks in this crate's own README as doctests so its quick start is
// type-checked on every test run and cannot silently rot. The `cfg(doctest)` gate keeps this out
// of the rendered crate documentation: see `retroglyph-crossterm`'s matching include for the
// same pattern applied to the workspace root README.
;
// clippy::too_long_first_doc_paragraph is a known-noisy nursery lint (rust-lang/rust-clippy#13441)
// that here misattributes its span across every subsequent `pub mod`/`pub use` declaration below
// (through to the next blank line) rather than just this one doc comment, which is well under
// its own 100-char threshold in isolation: confirmed by testing shorter wording alone, which
// silences it despite touching nothing else in that byte range.
/// Time-driven value animation: easing curves, a stateful `Tween`, and a periodic oscillator.
/// The `App`-driven game loop.
/// Pluggable rendering backends.
/// A scrolling viewport into a world larger than the screen.
/// Which diagnostics a build compiles in.
/// Fixed-timestep accumulator for game loops.
/// The one grid-drawing primitive: an area-clipped, single-layer view over a [`Grid`].
/// The atomic drawable unit (glyph, style, sub-cell offsets).
pub use ;
pub use ;
pub use ;
pub use ;
pub use Camera;
pub use ;
pub use ;
pub use ;
pub use FrameClock;
pub use BlendMode;
pub use ;
pub use ;
pub use Style;
pub use ;
pub use ;
pub use Terminal;
pub use ;
pub use Tile;
pub use Tint;