Add the main menu #31

Merged
CoCo_Sol merged 25 commits from main-menu into main 2024-02-09 23:42:37 +00:00
2 changed files with 7 additions and 5 deletions
Showing only changes of commit 72503edbac - Show all commits

View file

@ -1,9 +1,10 @@
//! The main entry point of the game. //! The main entry point of the game.
use bevy::prelude::*; use bevy::prelude::*;
mod menu;
use menu::MenuPlugin; use menu::MenuPlugin;
CoCo_Sol marked this conversation as resolved Outdated

Module creation should be after imports, not in between.

Module creation should be after imports, not in between.
mod menu;
fn main() { fn main() {
App::new() App::new()
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)

View file

@ -32,7 +32,8 @@ impl Plugin for MenuPlugin {
/// ``` /// ```
/// App::new() /// App::new()
/// .add_plugins(DefaultPlugins) /// .add_plugins(DefaultPlugins)
/// .add_plugins(MenuPlugin); // .add_systems(Update, ui_connect_button) /// .add_plugins(EguiPlugin)
/// .add_systems(Update, ui_connect_button);
CoCo_Sol marked this conversation as resolved Outdated

This example does not use the function.

This example does not use the function.
/// ``` /// ```
fn ui_connect_button(mut address: ResMut<Address>, mut egui_ctx: EguiContexts) { fn ui_connect_button(mut address: ResMut<Address>, mut egui_ctx: EguiContexts) {
CoCo_Sol marked this conversation as resolved Outdated

You should use a local resource instead.

You should use a local resource instead.
// Create the window // Create the window
@ -63,14 +64,14 @@ fn ui_connect_button(mut address: ResMut<Address>, mut egui_ctx: EguiContexts) {
/// ``` /// ```
/// App::new() /// App::new()
/// .add_plugins(DefaultPlugins) /// .add_plugins(DefaultPlugins)
/// .add_plugins(MenuPlugin); // .add_systems(Update, ui_host_button) /// .add_plugins(EguiPlugin)
CoCo_Sol marked this conversation as resolved Outdated

This example does not use the function.

This example does not use the function.
/// ``` /// .add_systems(Update, ui_host_button);
fn ui_host_button(mut egui_ctx: EguiContexts, mut address: ResMut<Address>) { fn ui_host_button(mut egui_ctx: EguiContexts, mut address: ResMut<Address>) {
// Create the window // Create the window
egui::Window::new("Host") egui::Window::new("Host")
.default_width(400.0) .default_width(400.0)
.show(egui_ctx.ctx_mut(), |ui| { .show(egui_ctx.ctx_mut(), |ui| {
// Create the text // Create a button to create a new game
CoCo_Sol marked this conversation as resolved Outdated

Bad comment

Bad comment
let button = ui.button("Create new game"); let button = ui.button("Create new game");
// Create the host button // Create the host button