SDL Wiki
(This is the documentation for SDL3, which is the current stable version. SDL2 was the previous version!)

SDL_NSTimerCallback

Function prototype for the nanosecond timer callback function.

Header File

Defined in <SDL3/SDL_timer.h>

Syntax

typedef Uint64 (SDLCALL *SDL_NSTimerCallback)(void *userdata, SDL_TimerID timerID, Uint64 interval);

Function Parameters

userdata an arbitrary pointer provided by the app through SDL_AddTimer, for its own use.
timerID the current timer being processed.
interval the current callback time interval.

Return Value

Returns the new callback time interval, or 0 to disable further runs of the callback.

Remarks

The callback function is passed the current timer interval and returns the next timer interval, in nanoseconds. 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 canceled and will be removed.

Thread Safety

SDL may call this callback at any time from a background thread; the application is responsible for locking resources the callback touches that need to be protected.

Version

This datatype is available since SDL 3.1.3.

See Also


CategoryAPI, CategoryAPIDatatype, CategoryTimer


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.