zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_timer.h File Reference
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Typedefs

typedef voidparam
 
typedef int SDL_TimerID
 

Functions

DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer (Uint32 interval, SDL_TimerCallback callback, void *param)
 Add a new timer to the pool of timers already running. More...
 
DECLSPEC void SDLCALL SDL_Delay (Uint32 ms)
 Wait a specified number of milliseconds before returning. More...
 
DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter (void)
 Get the current value of the high resolution counter. More...
 
DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency (void)
 Get the count per second of the high resolution counter. More...
 
DECLSPEC Uint32 SDLCALL SDL_GetTicks (void)
 Get the number of milliseconds since the SDL library initialization. More...
 
DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer (SDL_TimerID id)
 Remove a timer knowing its ID. More...
 
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval
 

Detailed Description

Header for the SDL time management routines.

Definition in file SDL_timer.h.

Typedef Documentation

typedef void* param

Definition at line 70 of file SDL_timer.h.

typedef int SDL_TimerID

Definition of the timer ID type.

Definition at line 75 of file SDL_timer.h.

Function Documentation

DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer ( Uint32  interval,
SDL_TimerCallback  callback,
void param 
)

Add a new timer to the pool of timers already running.

Returns
A timer ID, or NULL when an error occurs.

Definition at line 284 of file SDL_timer.c.

References SDL_AtomicIncRef, SDL_AtomicLock(), SDL_AtomicUnlock(), SDL_FALSE, SDL_free(), SDL_GetTicks(), SDL_LockMutex(), SDL_malloc(), SDL_OutOfMemory, SDL_RemoveTimer(), SDL_SemPost(), SDL_timer_data, SDL_TimerInit(), and SDL_UnlockMutex().

Referenced by SDLTest_SetTestTimeout().

DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter ( void  )

Get the current value of the high resolution counter.

Definition at line 59 of file SDL_systimer.c.

References SDL_GetTicks().

DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency ( void  )

Get the count per second of the high resolution counter.

Definition at line 65 of file SDL_systimer.c.

DECLSPEC Uint32 SDLCALL SDL_GetTicks ( void  )

Get the number of milliseconds since the SDL library initialization.

Note
This value wraps if the program runs for more than ~49 days.

Definition at line 44 of file SDL_systimer.c.

References NULL, SDL_InitTicks(), and ticks_started.

Referenced by SDL_AddTimer(), SDL_GetPerformanceCounter(), SDL_PushEvent(), SDL_SemWaitTimeout(), SDL_TimerThread(), and SDL_WaitEventTimeout().

DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer ( SDL_TimerID  id)

Remove a timer knowing its ID.

Returns
A boolean value indicating success or failure.
Warning
It is not safe to remove a timer multiple times.

Definition at line 354 of file SDL_timer.c.

References NULL, SDL_FALSE, SDL_free(), SDL_LockMutex(), SDL_timer_data, SDL_TRUE, and SDL_UnlockMutex().

Referenced by SDL_AddTimer(), and SDLTest_RunTest().

typedef Uint32 ( SDLCALL SDL_TimerCallback)

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.