render main player's hand
This commit is contained in:
parent
30d19ed9d9
commit
314c3299ef
8 changed files with 134 additions and 97 deletions
|
|
@ -1,10 +1,12 @@
|
|||
use bevy::prelude::*;
|
||||
use bevy_ratatui::RatatuiContext;
|
||||
use jong::game::player::{MainPlayer, Player};
|
||||
|
||||
use crate::tui::render::hand;
|
||||
|
||||
pub(crate) fn draw_ingame(
|
||||
rendered_hand: Res<hand::RenderedHand>,
|
||||
main_player: Single<Entity, (With<Player>, With<MainPlayer>)>,
|
||||
mut tui_ctx: ResMut<RatatuiContext>,
|
||||
) -> Result {
|
||||
use ratatui::layout::Flex;
|
||||
|
|
@ -17,8 +19,9 @@ pub(crate) fn draw_ingame(
|
|||
let mut area = frame.area();
|
||||
area.height = 4;
|
||||
let areas = layout.areas::<13>(area);
|
||||
if let Some(tiles) = rendered_hand.0.first() {
|
||||
for (tile, area) in tiles.iter().zip(areas.iter()) {
|
||||
// if let Some(hand) = rendered_hand.0.get(&*main_player) {
|
||||
if let Some(hand) = rendered_hand.0.get(&*main_player) {
|
||||
for (tile, area) in hand.iter().zip(areas.iter()) {
|
||||
frame.render_widget(tile, *area);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue