Change structure of files
Some checks failed
Rust Checks / checks (push) Failing after 9s
Rust Checks / checks (pull_request) Failing after 6s

This commit is contained in:
CoCo_Sol 2024-02-10 17:06:26 +01:00
parent 9dee5ad781
commit b69672356a
4 changed files with 21 additions and 5 deletions

View file

@ -2,7 +2,7 @@
use bevy::prelude::*; use bevy::prelude::*;
pub mod menu; pub mod menus;
/// The state of the game. /// The state of the game.
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)] #[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]

View file

@ -1,13 +1,13 @@
//! The main entry point of the game. //! The main entry point of the game.
use bevy::prelude::*; use bevy::prelude::*;
use border_wars::menu::MenuPlugin; use border_wars::menus::MenusPlugin;
use border_wars::GameState; use border_wars::GameState;
fn main() { fn main() {
App::new() App::new()
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_state::<GameState>() .add_state::<GameState>()
.add_plugins(MenuPlugin) .add_plugins(MenusPlugin)
.run(); .run();
} }

View file

@ -1,7 +1,7 @@
//! The main menu of the game. //! The main menu of the game.
use bevy::prelude::*; use bevy::prelude::*;
use bevy_egui::{egui, EguiContexts, EguiPlugin}; use bevy_egui::{egui, EguiContexts};
use crate::GameState; use crate::GameState;
@ -10,7 +10,7 @@ pub struct MenuPlugin;
impl Plugin for MenuPlugin { impl Plugin for MenuPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugins(EguiPlugin).add_systems( app.add_systems(
Update, Update,
menu_ui.run_if(state_exists_and_equals(GameState::Menu)), menu_ui.run_if(state_exists_and_equals(GameState::Menu)),
); );

View 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);
}
}