smol cleanup
This commit is contained in:
parent
2447e60f16
commit
441e729dee
6 changed files with 90 additions and 78 deletions
|
|
@ -1,6 +1,10 @@
|
|||
use bevy::prelude::*;
|
||||
use bevy_ratatui::RatatuiContext;
|
||||
use ratatui::Frame;
|
||||
use ratatui::{
|
||||
Frame,
|
||||
widgets::{Block, Clear},
|
||||
};
|
||||
use tui_logger::TuiLoggerWidget;
|
||||
|
||||
pub(crate) mod hand;
|
||||
pub(crate) mod ingame;
|
||||
|
|
@ -13,12 +17,23 @@ pub(crate) struct WidgetStack(pub(crate) Vec<Box<dyn FnOnce(&mut Frame) + Send +
|
|||
#[derive(Component)]
|
||||
pub(crate) struct Hovered;
|
||||
|
||||
pub(crate) fn draw_console(mut widgets: ResMut<WidgetStack>) {
|
||||
widgets.0.push(Box::new(|frame| {
|
||||
let block = Block::bordered().title("console");
|
||||
frame.render_widget(Clear, frame.area());
|
||||
frame.render_widget(
|
||||
TuiLoggerWidget::default().block(block),
|
||||
frame.area(), /* .inner(Margin { horizontal: 8, vertical: 8 }) */
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
||||
pub(crate) fn draw_system(
|
||||
mut tui_ctx: ResMut<RatatuiContext>,
|
||||
mut widgetstack: ResMut<WidgetStack>,
|
||||
mut widgets: ResMut<WidgetStack>,
|
||||
) -> Result {
|
||||
tui_ctx.draw(|frame| {
|
||||
for widget in widgetstack.0.drain(..) {
|
||||
for widget in widgets.0.drain(..) {
|
||||
widget(frame)
|
||||
}
|
||||
})?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue