timer topic

CategoryTimer

SDL provides time management functionality. It is useful for dealing with (usually) small durations of time.

This is not to be confused with calendar time management, which is provided by CategoryTime.

This category covers measuring time elapsed (SDL_GetTicks(), SDL_GetPerformanceCounter()), putting a thread to sleep for a certain amount of time (SDL_Delay(), SDL_DelayNS(), SDL_DelayPrecise()), and firing a callback function after a certain amount of time has elapsed (SDL_AddTimer(), etc).

There are also useful macros to convert between time units, like SDL_SECONDS_TO_NS() and such.

Functions

sdlAddTimer(int interval, Pointer<NativeFunction<SdlTimerCallback>> callback, Pointer<NativeType> userdata) int timer
Call a callback function at a future time.
sdlAddTimerNs(int interval, Pointer<NativeFunction<SdlNsTimerCallback>> callback, Pointer<NativeType> userdata) int timer
Call a callback function at a future time.
sdlDelay(int ms) → void timer
Wait a specified number of milliseconds before returning.
sdlDelayNs(int ns) → void timer
Wait a specified number of nanoseconds before returning.
sdlDelayPrecise(int ns) → void timer
Wait a specified number of nanoseconds before returning.
sdlGetPerformanceCounter() int timer
Get the current value of the high resolution counter.
sdlGetPerformanceFrequency() int timer
Get the count per second of the high resolution counter.
sdlGetTicks() int timer
Get the number of milliseconds that have elapsed since the SDL library initialization.
sdlGetTicksNs() int timer
Get the number of nanoseconds since SDL library initialization.
sdlRemoveTimer(int id) bool timer
Remove a timer created with SDL_AddTimer().