#System-based animations with `WinitSettings::desktop_app`

4 messages · Page 1 of 1 (latest)

tawny iris
#

If I have my app setup with .insert_resource(WinitSettings::desktop_app()), how can I force certain systems to run normally?

The problem is that I have a system, animate_loading_images, that will do an opacity animation on a FixedUpdate. It looks pretty good with WinitSettings::game but not with WinitSettings::desktop_app where it only steps the animation once every 5 seconds or until I move the mouse.

I tried sending a RequestRedraw event from within the system but that didn't seem to work.

Is there a way to make a system run normally despite the WinitSettings?

tawny storm
#

I'm going to eat but looking at the code quickly it looks like the RequestRedraw event is consumed (and triggers the should_update later) here: https://github.com/bevyengine/bevy/blob/972ca6283181dbb6d8c1457c39136b26f0a6ee04/crates/bevy_winit/src/lib.rs#L697 but this function is called when a Winit RedrawRequested event is read here : https://github.com/bevyengine/bevy/blob/972ca6283181dbb6d8c1457c39136b26f0a6ee04/crates/bevy_winit/src/lib.rs#L607 or here: https://github.com/bevyengine/bevy/blob/972ca6283181dbb6d8c1457c39136b26f0a6ee04/crates/bevy_winit/src/lib.rs#L383 but not sure about when this last case happen.

GitHub

A refreshingly simple data-driven game engine built in Rust - bevyengine/bevy

tawny iris
#

Hm, I just switched it over from FixedUpdate to Update and the RequestRedraw event seems to work correctly now. I'm guessing because FixedUpdate doesn't run every tick?

#

I had it in FixedUpdate since I thought it would help the animations appear smoother in case of lag spikes (which I have no clue if that's even remotely accurate or not haha), but I can do without it