Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values.
Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
This commit is contained in:
parent
04e170ceb7
commit
f5fa492e26
12 changed files with 23 additions and 21 deletions
|
@ -44,6 +44,17 @@ extern "C" {
|
|||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
||||
|
||||
/**
|
||||
* \brief Compare SDL ticks values, and return true if A has passed B
|
||||
*
|
||||
* e.g. if you want to wait 100 ms, you could do this:
|
||||
* Uint32 timeout = SDL_GetTicks() + 100;
|
||||
* while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
|
||||
* ... do work until timeout has elapsed
|
||||
* }
|
||||
*/
|
||||
#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
|
||||
|
||||
/**
|
||||
* \brief Get the current value of the high resolution counter
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue