draw queue

This commit is contained in:
Tao Tien 2026-01-13 17:05:56 -08:00
parent 3b026c73cd
commit 2447e60f16
6 changed files with 90 additions and 41 deletions

View file

@ -1,8 +1,26 @@
use bevy::prelude::*;
use bevy_ratatui::RatatuiContext;
use ratatui::Frame;
pub(crate) mod hand;
pub(crate) mod ingame;
pub(crate) mod menu;
pub(crate) mod tile;
#[derive(Resource, Default)]
pub(crate) struct WidgetStack(pub(crate) Vec<Box<dyn FnOnce(&mut Frame) + Send + Sync>>);
#[derive(Component)]
pub(crate) struct Hovered;
pub(crate) fn draw_system(
mut tui_ctx: ResMut<RatatuiContext>,
mut widgetstack: ResMut<WidgetStack>,
) -> Result {
tui_ctx.draw(|frame| {
for widget in widgetstack.0.drain(..) {
widget(frame)
}
})?;
Ok(())
}