Function tetra::time::get_delta_time[][src]

pub fn get_delta_time(ctx: &Context) -> Duration
Expand description

Returns the amount of time that has passed since the last update or draw.

This can be used to integrate the amount of time that has passed into your game’s calculations. For example, if you wanted to move a Vec2 32 units to the right per second, you could do foo.y += 32.0 * time::get_delta_time(ctx).as_secs_f32().

When using a fixed time step, calling this function during an update will always return the configured update rate. This is to prevent floating point error/non-determinism from creeping into your game’s calculations!