Add the main menu #31

Merged
CoCo_Sol merged 25 commits from main-menu into main 2024-02-09 23:42:37 +00:00
Showing only changes of commit cb33e5c3f4 - Show all commits

View file

@ -11,13 +11,13 @@ 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) app.add_plugins(EguiPlugin)
.add_systems(Update, ui_connect_button) .add_systems(Update, ui_connect_window)
.add_systems(Update, ui_host_button); .add_systems(Update, ui_host_window);
} }
} }
/// Display a connect window, with a button to join a game and an input to enter /// Display a connect window, with a button to join a game and an input to enter
/// the address. /// the address.
fn ui_connect_button(mut ctx: EguiContexts, mut connection_string: Local<String>) { fn ui_connect_window(mut ctx: EguiContexts, mut connection_string: Local<String>) {
egui::Window::new("Connect") egui::Window::new("Connect")
.default_width(400.0) .default_width(400.0)
.show(ctx.ctx_mut(), |ui| { .show(ctx.ctx_mut(), |ui| {
@ -36,7 +36,7 @@ fn ui_connect_button(mut ctx: EguiContexts, mut connection_string: Local<String>
} }
/// Display an host window, with a button to create a new game. /// Display an host window, with a button to create a new game.
fn ui_host_button(mut ctx: EguiContexts) { fn ui_host_window(mut ctx: EguiContexts) {
egui::Window::new("Host") egui::Window::new("Host")
.default_width(400.0) .default_width(400.0)
.show(ctx.ctx_mut(), |ui| { .show(ctx.ctx_mut(), |ui| {