vg4->misc->wait_time()
Sleep the rest of a defined time.
SYNTAX
int
vg4->misc->wait_time(int m_sec)
FUNCTION PARAMETERS
| m_sec | Time in milliseconds between two calls of this function |
RETURN VALUE
Returns the actual slept time
DESCRIPTION
Sleep the rest of a defined time.
This function is mainly used in a game-loop, because each game-loop should take the same time.
The executing code will take some time,
and so this function sleeps the rest of the time defined in m_sec.
Of course the time in m_sec should not be too small to avoid overruns.
EXAMPLE
/* Example: each game-loop should take 50 milliseconds */
/* game-loop */
for (;;) {
if (!vg4->input->update(VG_TRUE)) { break; }
[... execute some code ...]
/* now sleep the rest of 50 milliseconds this game-loop should take */
vg4->misc->wait_time(50);
}