diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-01 17:58:03 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-01 17:58:03 +0100 |
| commit | 46202ee2e398ffd49febe6684f5c6a8648da600d (patch) | |
| tree | 00631532b6b4805ddc8a728246787651dd7185f2 /src/client/tui.rs | |
| parent | docs: document DOWNLOAD_URL and the XDG reset path (diff) | |
| download | zagan-bet-46202ee2e398ffd49febe6684f5c6a8648da600d.tar.gz zagan-bet-46202ee2e398ffd49febe6684f5c6a8648da600d.zip | |
v4.0.1: introduce Command/View and port roulette to the shared boundary
Diffstat (limited to 'src/client/tui.rs')
| -rw-r--r-- | src/client/tui.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client/tui.rs b/src/client/tui.rs new file mode 100644 index 0000000..9a4e4da --- /dev/null +++ b/src/client/tui.rs | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | //! Text rendering for the terminal adapter. | ||
| 2 | //! | ||
| 3 | //! This is the TUI's half of the `View` boundary: the GUI renders the same | ||
| 4 | //! data with a painter instead of strings. | ||
| 5 | |||
| 6 | use crate::client::games::roulette::RouletteGame; | ||
| 7 | use crate::client::view::View; | ||
| 8 | |||
| 9 | /// Render any view to terminal lines. | ||
| 10 | pub fn render_view(view: &View) -> Vec<String> { | ||
| 11 | match view { | ||
| 12 | View::Roulette(roulette) => RouletteGame::render_view(roulette) | ||
| 13 | .lines() | ||
| 14 | .map(str::to_string) | ||
| 15 | .collect(), | ||
| 16 | View::Text(lines) => lines.clone(), | ||
| 17 | } | ||
| 18 | } | ||
