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 a bit of a prototype; it may not work well, it may not work reliably cross-platform, and it may not be a good idea in the first place. It depends on how accurate Rust's std::thread::sleep() is, which is to some extent at the mercy of what the OS decides to do.