generated from tipragot/rust
Add the main menu #31
|
@ -1,9 +1,10 @@
|
||||||
//! The file that contains utility functions, enums, structs of the game.
|
//! The file that contains utility functions, enums, structs of the game.
|
||||||
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
|
pub mod menu;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
|
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
|
||||||
pub enum GameState {
|
pub enum GameState {
|
||||||
#[default]
|
#[default]
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
//! The main entry point of the game.
|
//! The main entry point of the game.
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use lib::GameState;
|
use border_wars::menu::MenuPlugin;
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
|
|||||||
use menu::MenuPlugin;
|
use border_wars::GameState;
|
||||||
|
|
||||||
mod lib;
|
|
||||||
mod menu;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
|
|
|
@ -12,6 +12,10 @@ pub struct MenuPlugin;
|
||||||
impl Plugin for MenuPlugin {
|
impl Plugin for MenuPlugin {
|
||||||
/// A function that is called when the plugin is added to the application.
|
/// A function that is called when the plugin is added to the application.
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
|
app.add_plugins(EguiPlugin).add_systems(
|
||||||
|
Update,
|
||||||
|
(ui_connect_window, ui_host_window).run_if(in_state(GameState::Menu)),
|
||||||
|
);
|
||||||
println!("{:?}", app.world.resource::<State<GameState>>());
|
println!("{:?}", app.world.resource::<State<GameState>>());
|
||||||
app.add_plugins(EguiPlugin).add_systems(
|
app.add_plugins(EguiPlugin).add_systems(
|
||||||
Update,
|
Update,
|
||||||
|
|
Loading…
Reference in a new issue
Module creation should be after imports, not in between.