basic main menu (change this to generic overlay menu later?)
This commit is contained in:
parent
bc3421a371
commit
759ff410c2
6 changed files with 88 additions and 46 deletions
|
|
@ -8,7 +8,7 @@ use jong::game::GameState;
|
|||
use jong::game::wall::InWall;
|
||||
|
||||
mod console;
|
||||
mod input;
|
||||
mod menu;
|
||||
mod render;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, States, Default)]
|
||||
|
|
@ -31,27 +31,39 @@ impl Plugin for RiichiTui {
|
|||
))),
|
||||
RatatuiPlugins {
|
||||
// enable_kitty_protocol: todo!(),
|
||||
// enable_mouse_capture: todo!(),
|
||||
enable_input_forwarding: true,
|
||||
enable_mouse_capture: true,
|
||||
// enable_input_forwarding: false,
|
||||
..Default::default()
|
||||
},
|
||||
))
|
||||
.add_plugins(StatesPlugin)
|
||||
|
||||
// setup console
|
||||
.init_state::<console::ConsoleState>()
|
||||
.add_systems(Update, console::toggle_console)
|
||||
.add_systems(Update, console::draw_console.run_if(in_state(console::ConsoleState::Open)))
|
||||
|
||||
// other setup
|
||||
.init_state::<TuiState>()
|
||||
.add_systems(Update, render::draw_mainmenu.run_if(in_state(TuiState::MainMenu)))
|
||||
// .add_systems(Update, input::keyboard_input_system)
|
||||
// .add_systems()
|
||||
.add_computed_state::<InGame>()
|
||||
// main menu
|
||||
.add_systems(Update, (menu::draw_mainmenu,menu::mainmenu_input).run_if(in_state(TuiState::MainMenu)))
|
||||
// gaming
|
||||
.add_systems(Update, render::ingame::draw_ingame.run_if(in_state(TuiState::InGame)))
|
||||
.add_systems(Update, render::hand::render_changed_hand.run_if(in_state(GameState::Play)))
|
||||
.add_systems(Update, render::hand::render_changed_hand.run_if(in_state(InGame).and(in_state(GameState::Play))))
|
||||
// semicolon stopper
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
// fn prompt_names() {}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
|
||||
struct InGame;
|
||||
|
||||
impl ComputedStates for InGame {
|
||||
type SourceStates = TuiState;
|
||||
|
||||
fn compute(sources: Self::SourceStates) -> Option<Self> {
|
||||
match sources {
|
||||
TuiState::MainMenu => None,
|
||||
TuiState::InGame => Some(Self),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue