Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minimising example minimizing every frame #15850

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/window/minimising.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! A test to confirm that `bevy` allows minimising the window
//! This is run in CI to ensure that this doesn't regress again.
use bevy::prelude::*;
use bevy::{core::FrameCount, prelude::*};

fn main() {
// TODO: Combine this with `resizing` once multiple_windows is simpler than
Expand All @@ -18,13 +18,13 @@ fn main() {
.run();
}

fn minimise_automatically(mut windows: Query<&mut Window>, mut frames: Local<u32>) {
if *frames == 60 {
let mut window = windows.single_mut();
window.set_minimized(true);
} else {
*frames += 1;
fn minimise_automatically(mut windows: Query<&mut Window>, frames: Res<FrameCount>) {
if frames.0 != 60 {
return;
}

let mut window = windows.single_mut();
window.set_minimized(true);
}

/// A simple 3d scene, taken from the `3d_scene` example
Expand Down