[−][src]Function tetra::time::get_delta_time
pub fn get_delta_time(ctx: &Context) -> Duration
Returns the amount of time that has passed since the last frame was rendered.
When using a variable time step, you should use this 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 would do
foo.y += 32.0 * time::get_delta_time(ctx).as_secs_f32()
When using a fixed time step, the above still applies, but only to rendering - you should not integrate the delta time into your update calculations.