diff --git a/crates/border-wars/src/menu.rs b/crates/border-wars/src/menu.rs index 4dd0afe..f3a387c 100644 --- a/crates/border-wars/src/menu.rs +++ b/crates/border-wars/src/menu.rs @@ -3,81 +3,44 @@ use bevy::prelude::*; use bevy_egui::{egui, EguiContexts, EguiPlugin}; -/// A struc to store the address and if the game is being hosted or joined. -#[derive(Default, Resource)] -struct Address { - /// If the game is being hosted or joined. - /// True => Host, False => Join - host: bool, - /// The IP of the game. - /// The string you will share to connect to the game. - ip: String, -} - /// The plugin for the menu. pub struct MenuPlugin; /// Implement a trait in order to transform the struc into a plugin. impl Plugin for MenuPlugin { - /// The fonction that been called when the plugin is added to the app. + /// A function that is called when the plugin is added to the application. fn build(&self, app: &mut App) { app.add_plugins(EguiPlugin) - .init_resource::
() .add_systems(Update, ui_connect_button) .add_systems(Update, ui_host_button); } } -/// The creation of the connection window. -/// example: -/// ``` -/// App::new() -/// .add_plugins(DefaultPlugins) -/// .add_plugins(EguiPlugin) -/// .add_systems(Update, ui_connect_button); -/// ``` -fn ui_connect_button(mut address: ResMut, mut egui_ctx: EguiContexts) { - // Create the window +/// Display a connect window, with a button to join a game and an input to enter the address. +fn ui_connect_button(mut ctx: EguiContexts, mut connection_string: Local