pub fn drain_frame_requests(
events: MessageReader<'_, '_, ScriptCommandEvent>,
hook: ResMut<'_, FrameHook>,
animations: Option<Res<'_, AnimationsActive>>,
waker: Option<Res<'_, EventLoopWaker>>,
)Expand description
Read the RequestFrame commands emitted this tick and arm the hook.
Registered after every set that calls into a host, because a request is
only worth anything on the tick it was made: arming is what raises the
animation flag and wakes the loop, so a request this system ran past does
not merely arrive late, it lets an idle app park and never arrive at all.
A request made from inside on_frame therefore arms the next tick rather
than re-entering this one, which is what keeps a loop at one callback per
tick.
Both the animation flag and the waker are optional so a bare test can drive these systems without a window.