| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | 3. This notice may not be removed or altered from any source distribution. |
| | | */ |
| | | |
| | | #ifndef _SDL_timer_h |
| | | #define _SDL_timer_h |
| | | #ifndef SDL_timer_h_ |
| | | #define SDL_timer_h_ |
| | | |
| | | /** |
| | | * \file SDL_timer.h |
| | |
| | | * \note This value wraps if the program runs for more than ~49 days. |
| | | */ |
| | | 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 |
| | |
| | | /** |
| | | * \brief Add a new timer to the pool of timers already running. |
| | | * |
| | | * \return A timer ID, or NULL when an error occurs. |
| | | * \return A timer ID, or 0 when an error occurs. |
| | | */ |
| | | extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, |
| | | SDL_TimerCallback callback, |
| | |
| | | #endif |
| | | #include "close_code.h" |
| | | |
| | | #endif /* _SDL_timer_h */ |
| | | #endif /* SDL_timer_h_ */ |
| | | |
| | | /* vi: set ts=4 sw=4 expandtab: */ |