generated from tipragot/rust
Add the main menu #31
|
@ -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
|
|||||||
|
|
||||||
|
mod menu;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
|
|
|
@ -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
tipragot
commented
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
tipragot
commented
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
tipragot
commented
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
tipragot
commented
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
|
||||||
|
|
Loading…
Reference in a new issue
Module creation should be after imports, not in between.