include/SDL_timer.h
changeset 7857 6388f5229bb7
parent 7191 75360622e65f
child 8149 681eb46b8ac4
     1.1 --- a/include/SDL_timer.h	Sun Oct 20 20:41:30 2013 -0700
     1.2 +++ b/include/SDL_timer.h	Sun Oct 20 20:42:55 2013 -0700
     1.3 @@ -45,6 +45,17 @@
     1.4  extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
     1.5  
     1.6  /**
     1.7 + * \brief Compare SDL ticks values, and return true if A has passed B
     1.8 + *
     1.9 + * e.g. if you want to wait 100 ms, you could do this:
    1.10 + *  Uint32 timeout = SDL_GetTicks() + 100;
    1.11 + *  while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
    1.12 + *      ... do work until timeout has elapsed
    1.13 + *  }
    1.14 + */
    1.15 +#define SDL_TICKS_PASSED(A, B)  ((Sint32)((B) - (A)) <= 0)
    1.16 +
    1.17 +/**
    1.18   * \brief Get the current value of the high resolution counter
    1.19   */
    1.20  extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);