Module ggez::timer
[−]
[src]
Timing and measurement functions.
ggez does not try to do any framerate limitation by default.
If you want to run at anything other than full-bore max speed all the time,
you should use either the sleep()
or sleep_until_next_frame()
function in
this module at the end of your GameState.draw()
callback.
sleep()
with a duration of 0 will just yield to the OS so it has a chance
to breathe before continuing with your game, while
sleep_until_next_frame()
will attempt to calculate how long it should
wait to hit the desired FPS and sleep that long.
Structs
TimeContext |
A structure that contains our time-tracking state. |
Functions
duration_to_f64 |
A convenience function to convert a Rust |
get_average_delta |
Gets the average time of a frame, averaged over the last 60 frames. |
get_delta |
Get the time between the start of the last frame and the current one; in other words, the length of the last frame. |
get_fps |
Gets the FPS of the game, averaged over the last 60 frames. |
get_time_since_start |
Returns the time since the game was initialized. |
sleep |
Pauses the current thread for the target duration.
Just calls |
sleep_until_next_frame |
This function will attempt to sleep the current thread until the beginning of the next frame should occur, to reach the desired FPS. |