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

@ -4,11 +4,12 @@ use bevy::{app::ScheduleRunnerPlugin, prelude::*, state::app::StatesPlugin};
use bevy_ratatui::RatatuiPlugins;
use jong::game::GameState;
use crate::tui::render::{WidgetStack, menu::Splash};
// use jong::game::wall::InWall;
mod console;
mod menu;
mod render;
mod input;
@ -58,25 +59,33 @@ impl Plugin for RiichiTui {
))
.add_plugins(StatesPlugin)
// console
.init_state::<console::ConsoleState>()
.add_systems(Last, console::draw_console.run_if(in_state(console::ConsoleState::Open)))
// general setup
.init_state::<TuiState>()
.add_computed_state::<InGame>()
.init_resource::<WidgetStack>()
.add_sub_state::<ZenState>()
.init_resource::<Splash>()
.init_state::<console::ConsoleState>()
.add_systems(PostUpdate, console::draw_console.run_if(in_state(console::ConsoleState::Open)))
// input
.add_systems(PreUpdate, input::keyboard::input_system)
.add_systems(PreUpdate, input::mouse::input_system.chain())
.add_systems(PreUpdate, input::mouse::input_system)
// main menu
.add_sub_state::<ZenState>()
.add_systems(Update, menu::draw_splash.run_if(in_state(TuiState::MainMenu)))
.add_systems(Update, menu::draw_mainmenu.after(menu::draw_splash).run_if(in_state(TuiState::MainMenu).and(in_state(ZenState::Menu))))
.add_systems(PostStartup, render::menu::init_splash)
.insert_resource(Time::<Fixed>::from_seconds(1.0))
.add_systems(FixedUpdate, render::menu::render_splash.run_if(in_state(TuiState::MainMenu)))
.add_systems(Update, render::menu::draw_splash.run_if(in_state(TuiState::MainMenu)))
.add_systems(Update, render::menu::draw_mainmenu.after(render::menu::draw_splash).run_if(in_state(TuiState::MainMenu).and(in_state(ZenState::Menu))))
// gaming
.init_resource::<render::hand::RenderedHand>()
.add_systems(Update, render::hand::render_hands.run_if(in_state(InGame).and(in_state(GameState::Play))))
.add_systems(Update, render::ingame::draw_ingame.run_if(in_state(InGame)))
// render
.add_systems(Last, render::draw_system.run_if(not(in_state(InGame))))
// semicolon stopper
;