Function ggez::timer::sleep_until_next_frame [] [src]

pub fn sleep_until_next_frame(ctx: &Context, desired_fps: u32)

This function will attempt to sleep the current thread until the beginning of the next frame should occur, to reach the desired FPS.

This is not an especially precise way to do timing; see the astroblasto example for how to do it better. However, this is very convenient for prototyping, so I'm leaving it in.