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

How can I stop bevy_egui from sending RequestRedraw whenever I move the mouse? #277

Closed
Maximetinu opened this issue Apr 23, 2024 · 0 comments

Comments

@Maximetinu
Copy link
Contributor

Hello ! 👋

bevy_egui is sending a RequestRedraw event to Bevy in the process_output_system, here:

bevy_egui/src/systems.rs

Lines 535 to 537 in 6021f22

if ctx.has_requested_repaint() {
event.send(RequestRedraw);
}

... when any of the EGUI contexts need a repaint

I'm using egui only for debugging purposes (a debug Window, similar to the bevy_inspector_egui) but I have a problem: even when my EGUI window is not opened at all (so, I'm not even running the systems to draw it), the EGUI systems run and send the RequestRedraw event

This is a problem for me because I want to control the frame rate, and I do not want to run a new frame, even if I receive an input event from a device or the window

Repro steps are fairly easy: in the simple.rs example of this repo, comment out the system. It will only show a black screen, but if you put a println! log in the piece of code sending the RequestRedraw event linked above, it will be called whenever the cursor moves on top of the screen

How can I disable this behaviour from my app? I'm trying to remove the EGUI Context from the PrimaryWindow, but there is an unwrap inside of bevy_egui that is expecting it, so it panics.

Since I think this cannot be done from outside of bevy_winit, I'm trying to modify the source code to run this system only when there is anything actually being painted, but I'm still digging through the code to learn how I can do it, so any advice is welcome 🙂

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

No branches or pull requests

1 participant