fix deal crash
This commit is contained in:
parent
759ff410c2
commit
65ea256436
6 changed files with 15 additions and 55 deletions
|
|
@ -39,7 +39,7 @@ pub(crate) fn mainmenu_input(
|
|||
match message.code {
|
||||
KeyCode::Char('p') => {
|
||||
next_tuistate.set(TuiState::InGame);
|
||||
next_gamestate.set(GameState::default());
|
||||
next_gamestate.set(GameState::Setup);
|
||||
}
|
||||
KeyCode::Char('q') => {
|
||||
exit.write_default();
|
||||
|
|
|
|||
|
|
@ -13,26 +13,9 @@ pub(crate) fn draw_ingame(
|
|||
use ratatui::layout::Flex;
|
||||
use ratatui::prelude::*;
|
||||
|
||||
// let title = ratatui::text::Text::raw("tiny riichi");
|
||||
|
||||
// let wall = if let Some(wall_tiles) = wall_tiles {
|
||||
// let wall_tiles = wall_tiles
|
||||
// .iter()
|
||||
// .map(|inwall| -> Result<_> { Ok(tiles.get(inwall).map(tiles::draw_tile)?) })
|
||||
// .collect::<Result<Vec<_>>>()?;
|
||||
|
||||
// // let paragraph = Paragraph::new(wall.join(", ")).wrap(ratatui::widgets::Wrap { trim: true });
|
||||
// Some(wall_tiles)
|
||||
// } else {
|
||||
// None
|
||||
// };
|
||||
|
||||
tui_ctx.draw(|frame| {
|
||||
// frame.render_widget(title, frame.area());
|
||||
debug!("{}", frame.area());
|
||||
|
||||
// if let Some(wall) = wall {
|
||||
// // let tile_area = Rect::new(0, 0, 5, 4);
|
||||
let layout = Layout::horizontal(vec![Constraint::Max(5); 13]).flex(Flex::Start);
|
||||
let mut area = frame.area();
|
||||
area.height = 4;
|
||||
|
|
@ -40,13 +23,6 @@ pub(crate) fn draw_ingame(
|
|||
for (tile, area) in rendered_hand.0.iter().zip(areas.iter()) {
|
||||
frame.render_widget(tile, *area);
|
||||
}
|
||||
|
||||
// // debug!("wall.len(): {}, areas.len(): {}", wall.len(), areas.len());
|
||||
// for (tile, rect) in wall.iter().zip(areas.iter()) {
|
||||
// // debug!("{rect:?}");
|
||||
// frame.render_widget(tile, *rect);
|
||||
// }
|
||||
// }
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,22 +1,3 @@
|
|||
use bevy::ecs::system::SystemParam;
|
||||
use bevy::prelude::*;
|
||||
use bevy_ratatui::RatatuiContext;
|
||||
use ratatui::{
|
||||
layout::{},
|
||||
widgets::Paragraph,
|
||||
};
|
||||
|
||||
use jong::{
|
||||
game::{
|
||||
player::Hand,
|
||||
wall::{Wall, WallTiles},
|
||||
},
|
||||
tiles::Tile,
|
||||
};
|
||||
|
||||
use crate::tui::TuiState;
|
||||
|
||||
pub(crate) mod hand;
|
||||
pub(crate) mod ingame;
|
||||
mod tiles;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue