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

Using WinitSettings::desktop_app() does not update egui UI #239

Closed
ThomasAlban opened this issue Jan 1, 2024 · 0 comments · Fixed by #240
Closed

Using WinitSettings::desktop_app() does not update egui UI #239

ThomasAlban opened this issue Jan 1, 2024 · 0 comments · Fixed by #240

Comments

@ThomasAlban
Copy link

I'm using WinitSettings::desktop_app() in my bevy app (so the window is only updated when a winit event is received or a RequestRedraw event is sent manually), but it seems that RequestRedraw events aren't sent by bevy_egui when the UI needs to be updated. This results in behaviour like this:

Screen.Recording.2024-01-01.at.23.27.09.mov

(although I click the collapsing header, it only collapses when I wiggle the mouse because that's when the next Winit event is received).

I tried to add this bevy system to the PostUpdate schedule to fix the problem:

fn redraw_window(mut contexts: EguiContexts, mut ev_request_redraw: EventWriter<RequestRedraw>) {
    let ctx = contexts.ctx_mut();
    // redraw the window if egui wants the window redrawn
    if ctx.input(|i| i.wants_repaint()) {
        ev_request_redraw.send(RequestRedraw);
    }
}

And it did partially fix it, as you can see in this screen recording:

Screen.Recording.2024-01-01.at.23.29.34.mov

But the window is still not being redrawn enough times.

Do you have any suggestions on getting this to work manually, or is there a chance this feature could be added to bevy_egui?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant