I was trying to make my own renderer with wgpu, and needed to resize the surface of the window so I decided to use the WindowResized event, however this event apparently does not trigger, causing the app to crash, because the surface isn't the same size as the window.
What went wrong
I was expecting the resize events to be triggered, and (seemingly) every other event does work, just not window resized.
Additional information
I recreated the bug with minimal code in a new bevy project, the code is below. As I said before it seems that all other events do trigger, just not the window resized event, however I haven't tested this exhaustively.
// main.rs
use bevy::prelude::*;
use bevy::{
a11y::AccessibilityPlugin,
window::WindowPlugin,
winit::{WinitPlugin, WakeUp, WinitEvent},
};
fn main() {
App::new()
.add_plugins(MinimalPlugins)
.add_plugins((
AccessibilityPlugin,
WindowPlugin::default(),
WinitPlugin::<WakeUp>::default(),
))
.add_systems(Update, read_resize_events)
.run();
}
fn read_resize_events(
mut resize_events: EventReader<WinitEvent>
) {
for event in resize_events.read() {
match event {
WinitEvent::WindowResized(_) => println!("Window was resized"),
_ => {}
}
}
}
[package]
name = "bevy_winit_events_test"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = { version = "0.14.2", default-features = false, features = ["bevy_winit"] }
Ok I just checked, there is a pull request that removes WindowResized from WinitEvents because it doesn't get sent there, and only gets send in EventReader, I'm pretty sure this is the problem?
Bevy version
0.14.2
Relevant system information
Windows 10 AdapterInfo { name: "NVIDIA GeForce RTX 3060 Laptop GPU", vendor: 4318, device: 9568, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "561.09", backend: Vulkan }
What I did
I was trying to make my own renderer with wgpu, and needed to resize the surface of the window so I decided to use the
WindowResized
event, however this event apparently does not trigger, causing the app to crash, because the surface isn't the same size as the window.What went wrong
I was expecting the resize events to be triggered, and (seemingly) every other event does work, just not window resized.
Additional information
I recreated the bug with minimal code in a new bevy project, the code is below. As I said before it seems that all other events do trigger, just not the window resized event, however I haven't tested this exhaustively.