pub fn fixed_steps(debt: &mut f32, delta_seconds: f32, step_seconds: f32) -> u32Expand description
Turn elapsed time into a whole number of fixed steps, carrying the rest into the next tick as debt.
debt is what earlier ticks owed and did not spend; the returned count
is how many steps the accumulated time now covers, and debt keeps the
fraction of a step left over. Debt past MAX_CATCH_UP_STEPS steps is
discarded rather than owed: a world that stalled for a long while - a
suspended process, a debugger pause - would otherwise run a burst of
steps to catch up, and simulating a pause that long is neither cheap nor
wanted.
A negative delta_seconds - a clock that went backwards - adds no time.