generated from tipragot/rust
Change of file structure for scenes #38
|
@ -2,7 +2,7 @@
|
|||
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub mod menu;
|
||||
pub mod menus;
|
||||
CoCo_Sol marked this conversation as resolved
Outdated
|
||||
|
||||
/// The state of the game.
|
||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
Rename Rename
|
||||
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//! The main entry point of the game.
|
||||
|
||||
use bevy::prelude::*;
|
||||
use border_wars::menu::MenuPlugin;
|
||||
use border_wars::menus::MenusPlugin;
|
||||
use border_wars::GameState;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_state::<GameState>()
|
||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
Add it in the ScenesPlugin instead. Add it in the ScenesPlugin instead.
|
||||
.add_plugins(MenuPlugin)
|
||||
.add_plugins(MenusPlugin)
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! The main menu of the game.
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_egui::{egui, EguiContexts, EguiPlugin};
|
||||
use bevy_egui::{egui, EguiContexts};
|
||||
|
||||
use crate::GameState;
|
||||
|
||||
|
@ -10,7 +10,7 @@ pub struct MenuPlugin;
|
|||
|
||||
impl Plugin for MenuPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins(EguiPlugin).add_systems(
|
||||
app.add_systems(
|
||||
Update,
|
||||
menu_ui.run_if(state_exists_and_equals(GameState::Menu)),
|
||||
);
|
16
crates/border-wars/src/menus/mod.rs
Normal file
16
crates/border-wars/src/menus/mod.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
//! All the menu's programme.
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_egui::EguiPlugin;
|
||||
|
||||
pub mod menu;
|
||||
|
||||
/// The plugin for all menus.
|
||||
pub struct MenusPlugin;
|
||||
|
||||
impl Plugin for MenusPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins(EguiPlugin)
|
||||
.add_plugins(menu::MenuPlugin);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue
I think we should call them scenes.