Skip to main content

run_loop

Function run_loop 

Source
pub fn run_loop(app: &mut App, pump_events: bool, on_tick: impl FnMut(&mut App))
Expand description

Drive the world loop to completion. Each iteration: exit if the shutdown token is cancelled; on macOS, when pump_events is set (a window is present), drain the pending AppKit/CoreFoundation events so the window stays responsive and Metal drawable callbacks fire; run the per-tick on_tick hook; then step the world, stopping on Stop/Done. on_tick is where the interpreted debug path ticks its DebugHook; the runtime passes a no-op.

pump_events is only meaningful on macOS (it gates the Cocoa pump): the caller sets it from whether the world actually renders, so a headless macOS world uses the same tight loop as every other platform.