From efa93ef8ddde6a0c8fa1738e9bd6fa628cc4c0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Wed, 29 Sep 2021 02:17:51 +0200 Subject: [PATCH 1/3] remove WindowDescriptor resource after use --- crates/bevy_window/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 79299dd9d0af1..a02206adedf4b 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -56,6 +56,7 @@ impl Plugin for WindowPlugin { .get_resource::() .map(|descriptor| (*descriptor).clone()) .unwrap_or_else(WindowDescriptor::default); + app.world.remove_resource::(); let mut create_window_event = app .world .get_resource_mut::>() From a905b40e41beefcd5e05d53137e39abb9800ffe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Wed, 29 Sep 2021 02:18:14 +0200 Subject: [PATCH 2/3] add doc comment explaining how to update window settings --- crates/bevy_window/src/window.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index be3a6c0f99230..d4be8ea1ab8b1 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -513,6 +513,10 @@ impl Window { } } +/// This resource will only be used as initialization to setup the window. +/// To change those settings during runtime, the [`Windows`](super::windows::Windows) +/// resource should be used. See example +/// [window_settings](https://github.com/bevyengine/bevy/blob/latest/examples/window/window_settings.rs) #[derive(Debug, Clone)] pub struct WindowDescriptor { pub width: f32, From 285739bf8d62688ab301f382adc18de5b9a75491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Sat, 2 Oct 2021 04:16:10 +0200 Subject: [PATCH 3/3] use value from remove if available Co-Authored-By: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> --- crates/bevy_window/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index a02206adedf4b..7d9c439c6cfa9 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -53,10 +53,8 @@ impl Plugin for WindowPlugin { if self.add_primary_window { let window_descriptor = app .world - .get_resource::() - .map(|descriptor| (*descriptor).clone()) + .remove_resource::() .unwrap_or_else(WindowDescriptor::default); - app.world.remove_resource::(); let mut create_window_event = app .world .get_resource_mut::>()