Can I stop Bevy from using the CPU when there is no need to redraw the screen?

209 views Asked by At

I'm just looking at the examples in Bevy, and I tried one of them with

$ cargo run --example blend_modes -r

and I noticed that it shows 30% CPU usage even when the screen does not change. I think that my potential users will have the expectation that an open but idle program won't drain their laptop battery too fast, and will find it annoying if it does.

So I'm wondering if this behavior is an inherent limitation of the engine, or if blend_modes.rs can be fixed so as to avoid unnecessary CPU usage?

1

There are 1 answers

4
Colonel Thirty Two On

Insert a WinitSettings resource with the appropriate UpdateModes set.

For example:

App::new()
    .insert_resource(WinitSettings::desktop_app())

Note that this will cause your systems to run only when input happens in your window.