reorder stuff for tui main menu

This commit is contained in:
Tao Tien 2026-01-11 22:32:30 -08:00
parent 3417384b86
commit 130bb38725
4 changed files with 60 additions and 34 deletions

26
src/tui/render/hand.rs Normal file
View file

@ -0,0 +1,26 @@
use bevy::prelude::*;
use ratatui::widgets::Paragraph;
use jong::game::player::HandTiles;
use jong::tiles::Tile;
use crate::tui::render::tiles;
#[derive(Component)]
pub(crate) struct RenderedHand<'a>(pub(crate) Vec<Paragraph<'a>>);
pub(crate) fn render_changed_hand(
hand: Single<&HandTiles, Changed<HandTiles>>,
// hand_tiles: Query<&HandTiles, With<Hand>>,
tiles: Query<&Tile>,
mut target: Single<&'static mut RenderedHand>,
) -> Result {
let hand_tiles = hand
.iter()
.map(|inhand| -> Result<_> { Ok(tiles.get(inhand).map(tiles::draw_tile)?) })
.collect::<Result<Vec<_>>>()?;
target.0 = hand_tiles;
Ok(())
}