add: playing with base TUI

This commit is contained in:
Charles
2024-11-11 21:43:34 -08:00
commit 20c48e3cc4
5 changed files with 658 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
use character_sheet::Character;
use crossterm::event::{self, Event};
use ratatui::{text::Text, Frame};
mod character_sheet;
fn main() {
let mut terminal = ratatui::init();
loop {
terminal.draw(draw).expect("failed to draw frame");
if matches!(event::read().expect("failed to read event"), Event::Key(_)) {
break;
}
}
ratatui::restore();
}
fn draw(frame: &mut Frame) {
let text = Text::raw("Hello World!");
frame.render_stateful_widget(
character_sheet::CharacterWidget{},
frame.area(),
&mut Character::new(),
);
}