From 92bdba23b09e0c969d3cfed8bf5f36ec30c51776 Mon Sep 17 00:00:00 2001 From: eickern Date: Sun, 30 Oct 2022 09:46:17 +0100 Subject: [PATCH 1/3] Do not attempt to open a second windowed Bevy App --- crates/bevy_window/src/lib.rs | 2 +- examples/app/return_after_run.rs | 29 ++++++++++------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index a00f851d35b5d..ecac9a4ae25d2 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -54,7 +54,7 @@ pub struct WindowPlugin { /// create 'headless' processes (processes without windows), which may /// surprise your users. It is recommended to leave this setting as `true`. /// - /// If true, this plugin will add [`exit_on_all_closed`] to [`CoreStage::Update`]. + /// If true, this plugin will add [`exit_on_all_closed`] to [`CoreStage::PostUpdate`]. pub exit_on_all_closed: bool, /// Whether to close windows when they are requested to be closed (i.e. /// when the close button is pressed). diff --git a/examples/app/return_after_run.rs b/examples/app/return_after_run.rs index bc7e2b1f0e3b9..125b1ce62b24b 100644 --- a/examples/app/return_after_run.rs +++ b/examples/app/return_after_run.rs @@ -3,33 +3,24 @@ use bevy::{prelude::*, winit::WinitSettings}; fn main() { - println!("Running first App."); + println!("Running Bevy App"); App::new() .insert_resource(WinitSettings { return_from_run: true, ..default() }) - .insert_resource(ClearColor(Color::rgb(0.2, 0.2, 0.8))) - .add_plugins(DefaultPlugins) - .add_system(system1) - .run(); - println!("Running another App."); - App::new() - .insert_resource(WinitSettings { - return_from_run: true, + .add_plugins(DefaultPlugins.set(WindowPlugin { + window: WindowDescriptor { + title: "Close window to return to main function".to_owned(), + ..default() + }, ..default() - }) - .insert_resource(ClearColor(Color::rgb(0.2, 0.8, 0.2))) - .add_plugins(DefaultPlugins.build().disable::()) - .add_system(system2) + })) + .add_system(system1) .run(); - println!("Done."); + println!("Bevy App has exited. We are back in our main function."); } fn system1() { - info!("logging from first app"); -} - -fn system2() { - info!("logging from second app"); + info!("Logging from Bevy App"); } From 2c21fd8cc1d97ad0da2bef5c7f588289a40f933c Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Sun, 30 Oct 2022 12:34:53 +0100 Subject: [PATCH 2/3] Update examples/app/return_after_run.rs Co-authored-by: ira --- examples/app/return_after_run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/app/return_after_run.rs b/examples/app/return_after_run.rs index 125b1ce62b24b..8c4e0375ed02f 100644 --- a/examples/app/return_after_run.rs +++ b/examples/app/return_after_run.rs @@ -21,6 +21,6 @@ fn main() { println!("Bevy App has exited. We are back in our main function."); } -fn system1() { +fn system() { info!("Logging from Bevy App"); } From 20fadcf0ae88cd0bdcac4adab4292305c996be51 Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Sun, 30 Oct 2022 12:34:58 +0100 Subject: [PATCH 3/3] Update examples/app/return_after_run.rs Co-authored-by: ira --- examples/app/return_after_run.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/app/return_after_run.rs b/examples/app/return_after_run.rs index 8c4e0375ed02f..966659688655e 100644 --- a/examples/app/return_after_run.rs +++ b/examples/app/return_after_run.rs @@ -11,12 +11,12 @@ fn main() { }) .add_plugins(DefaultPlugins.set(WindowPlugin { window: WindowDescriptor { - title: "Close window to return to main function".to_owned(), + title: "Close the window to return to the main function".to_owned(), ..default() }, ..default() })) - .add_system(system1) + .add_system(system) .run(); println!("Bevy App has exited. We are back in our main function."); }