Fix fmt and clippy
All checks were successful
Rust Checks / checks (push) Successful in 1m4s
Rust Checks / checks (pull_request) Successful in 1m3s

This commit is contained in:
CoCo_Sol 2024-02-10 00:18:50 +01:00
parent 4a4a53be85
commit 52c9112585
2 changed files with 8 additions and 5 deletions

View file

@ -1,14 +1,19 @@
//! 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; pub mod menu;
/// The state of the game.
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)] #[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
pub enum GameState { pub enum GameState {
/// The main menu.
#[default] #[default]
Menu, Menu,
/// The lobby where the host will wait for other players to join.
Lobby, Lobby,
/// The game.
Game, Game,
} }

View file

@ -12,10 +12,8 @@ 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( app.add_plugins(EguiPlugin)
Update, .add_systems(Update, menu_ui.run_if(in_state(GameState::Menu)));
(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,
@ -24,7 +22,7 @@ impl Plugin for MenuPlugin {
} }
} }
/// Display a window, with a button to join a game and an input to enter /// Display a window, with a button to join a game and an input to enter
/// the address or create a new game. /// TODO
fn menu_ui(mut ctx: EguiContexts, mut connection_string: Local<String>) { fn menu_ui(mut ctx: EguiContexts, mut connection_string: Local<String>) {
egui::CentralPanel::default().show(ctx.ctx_mut(), |ui| { egui::CentralPanel::default().show(ctx.ctx_mut(), |ui| {
ui.heading("Border Wars"); ui.heading("Border Wars");