SDL standard library

Dependents:   H261_encoder

Embed: (wiki syntax)

« Back to documentation index

SDL_timer.h File Reference

SDL_timer.h File Reference

Header for the SDL time management routines. More...

Go to the source code of this file.

Typedefs

typedef int SDL_TimerID
 Definition of the timer ID type.

Functions

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

Detailed Description

Header for the SDL time management routines.

Definition in file SDL_timer.h.


Typedef Documentation

typedef int SDL_TimerID

Definition of the timer ID type.

Definition at line 86 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.
DECLSPEC void SDLCALL SDL_Delay ( Uint32  ms )

Wait a specified number of milliseconds before returning.

DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter ( void   )

Get the current value of the high resolution counter.

DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency ( void   )

Get the count per second of the high resolution counter.

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.
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.
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.