Function ggez::timer::check_update_time
[−]
[src]
pub fn check_update_time(ctx: &mut Context, target_fps: u32) -> bool
This function will return true if the time since the
last update()
call has been equal to or greater to
the update FPS indicated by the desired_update_rate
.
It keeps track of fractional frames, so if you want
60 fps (16.67 ms/frame) and the game stutters so that
there is 40 ms between update()
calls, this will return
true
twice, and take the remaining 6.67 ms into account
in the next frame.
The intention is to for it to be called in a while loop
in your update()
callback:
ⓘThis example is not tested
fn update(&mut self, ctx: &mut Context) -> GameResult<()> while(timer::get_time_since_start(ctx, 60)) { update_game_physics()?; } Ok(()) }