diff options
Diffstat (limited to '')
| -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 | } | ||
