generated from tipragot/rust
Adding a lobby scene #34
|
@ -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)]
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)),
|
||||||
);
|
);
|
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