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

WindowResized events don't trigger #15268

Open
Pnoenix opened this issue Sep 17, 2024 · 1 comment
Open

WindowResized events don't trigger #15268

Pnoenix opened this issue Sep 17, 2024 · 1 comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@Pnoenix
Copy link

Pnoenix commented Sep 17, 2024

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.

// 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"] }
@Pnoenix Pnoenix added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 17, 2024
@alice-i-cecile alice-i-cecile added A-Windowing Platform-agnostic interface layer to run your app in S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Sep 17, 2024
@Pnoenix
Copy link
Author

Pnoenix commented Sep 17, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

2 participants