SDL
2.0
|
Go to the source code of this file.
Macros | |
#define | SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) |
Compare SDL ticks values, and return true if A has passed B. More... | |
Typedefs | |
typedef Uint32(* | SDL_TimerCallback) (Uint32 interval, void *param) |
typedef int | SDL_TimerID |
Functions | |
Uint32 | SDL_GetTicks (void) |
Get the number of milliseconds since the SDL library initialization. More... | |
Uint64 | SDL_GetPerformanceCounter (void) |
Get the current value of the high resolution counter. More... | |
Uint64 | SDL_GetPerformanceFrequency (void) |
Get the count per second of the high resolution counter. More... | |
void | SDL_Delay (Uint32 ms) |
Wait a specified number of milliseconds before returning. More... | |
SDL_TimerID | SDL_AddTimer (Uint32 interval, SDL_TimerCallback callback, void *param) |
Add a new timer to the pool of timers already running. More... | |
SDL_bool | SDL_RemoveTimer (SDL_TimerID id) |
Remove a timer knowing its ID. More... | |
Header for the SDL time management routines.
Definition in file SDL_timer.h.
#define SDL_TICKS_PASSED | ( | A, | |
B | |||
) | ((Sint32)((B) - (A)) <= 0) |
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 }
Definition at line 56 of file SDL_timer.h.
Referenced by SDL_PrivateSendMouseButton(), SDL_SemWaitTimeout(), and SDL_WaitEventTimeout().
Function prototype for the timer callback function.
The callback function is passed the current timer interval and returns the next timer interval. If the returned value is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled. If the callback returns 0, the periodic alarm is cancelled.
Definition at line 81 of file SDL_timer.h.
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) a int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID |
Definition of the timer ID type.
Definition at line 86 of file SDL_timer.h.
SDL_TimerID SDL_AddTimer | ( | Uint32 | interval, |
SDL_TimerCallback | callback, | ||
void * | param | ||
) |
Add a new timer to the pool of timers already running.
Definition at line 279 of file SDL_timer.c.
References SDL_TimerData::active, SDL_Timer::callback, callback(), SDL_Timer::canceled, SDL_TimerData::freelist, SDL_Timer::interval, SDL_TimerData::lock, SDL_Timer::next, SDL_TimerMap::next, SDL_TimerData::nextID, SDL_Timer::param, SDL_TimerData::pending, SDL_Timer::scheduled, SDL_AtomicGet, SDL_AtomicIncRef, SDL_AtomicLock, SDL_AtomicSet, SDL_AtomicUnlock, SDL_free, SDL_GetTicks(), SDL_LockMutex, SDL_malloc, SDL_OutOfMemory, SDL_RemoveTimer(), SDL_SemPost, SDL_timer_data, SDL_TimerInit(), SDL_UnlockMutex, SDL_TimerData::sem, SDL_TimerMap::timer, SDL_Timer::timerID, SDL_TimerMap::timerID, SDL_TimerData::timermap, and SDL_TimerData::timermap_lock.
Get the count per second of the high resolution counter.
Referenced by main(), render(), and timer_getPerformanceFrequency().
Get the number of milliseconds since the SDL library initialization.
Referenced by ConfigureBinding(), loop(), main(), runAdder(), RunFIFOTest(), SDL_AddTimer(), SDL_PrivateSendMouseButton(), SDL_PushEvent(), SDL_SemWaitTimeout(), SDL_TimerThread(), SDL_WaitEventTimeout(), TestWaitTimeout(), timer_delayAndGetTicks(), and WatchJoystick().
SDL_bool SDL_RemoveTimer | ( | SDL_TimerID | id | ) |
Remove a timer knowing its ID.
Definition at line 342 of file SDL_timer.c.
References SDL_Timer::canceled, SDL_TimerMap::next, NULL, SDL_AtomicGet, SDL_AtomicSet, SDL_FALSE, SDL_free, SDL_LockMutex, SDL_timer_data, SDL_TRUE, SDL_UnlockMutex, SDL_TimerMap::timer, SDL_TimerMap::timerID, SDL_TimerData::timermap, and SDL_TimerData::timermap_lock.
Referenced by SDL_AddTimer().