generated from tipragot/rust
Add the main menu #31
|
@ -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>
|
||||||
}
|
}
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
/// Display an host window, with a button to create a new game.
|
/// Display an host window, with a button to create a new game.
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
You should use a local resource instead. You should use a local resource instead.
|
|||||||
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| {
|
||||||
|
|
Loading…
Reference in a new issue
This example does not use the function.