SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::TimerCB Struct Reference

Function prototype for the nanosecond timer callback function. More...

Inheritance diagram for SDL::TimerCB:
Inheritance graph
[legend]
Collaboration diagram for SDL::TimerCB:
Collaboration graph
[legend]

Public Member Functions

template<std::invocable< TimerID, std::chrono::nanoseconds > F>
 TimerCB (const F &func)
 ctor
 
- Public Member Functions inherited from SDL::LightweightCallbackT< TimerCB, Uint64, TimerID, Uint64 >
 LightweightCallbackT (const F &func)
 ctor
 

Additional Inherited Members

- Public Attributes inherited from SDL::LightweightCallbackT< TimerCB, Uint64, TimerID, Uint64 >
Uint64(* wrapper )(void *, PARAMS...)
 The wrapper function.
 
void * data
 The wrapped data.
 

Detailed Description

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.

Parameters
timerIDthe current timer being processed.
intervalthe current callback time interval.
Returns
the new callback time interval, or 0 to disable further runs of the callback.
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.
Since
This datatype is available since SDL 3.2.0.
Category:
listener-callback
See also
AddTimer
TimerCallback

The documentation for this struct was generated from the following file: