Reputation: 23734
When running game in Bevy: At startup, I see a big window with white rectangle in it. After a few seconds my WindowDescriptor kicks in, and the window is resized to the dimensions that I want.
Is there a way to hide the window during the loading process, so I don't see the white rectangle? Or some other way to have my own loading screen?
I see this issue on the breakout example in Bevy. I am running in Windows10 OS.
Upvotes: 4
Views: 332
Reputation: 899
The window-settings example now illustrates how to achieve this. Summary:
Init the window invisibly:
App::new().add_plugins((
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
visible: false,
..default()
}),
..default()
}),
FrameTimeDiagnosticsPlugin,
)).add_systems(Update, make_visible).run();
Then make it visible after a few frames:
fn make_visible(mut window: Query<&mut Window>, frames: Res<FrameCount>) {
// The delay may be different for your app or system.
if frames.0 == 3 {
// At this point the gpu is ready to show the app so we can make the window visible.
// Alternatively, you could toggle the visibility in Startup.
// It will work, but it will have one white frame before it starts rendering
window.single_mut().visible = true;
}
}
I would suggest to additionally implement a loading screen. This can be done similarly to the game-menu example.
Upvotes: 0