SDL_TimerCallback

Type Alias SDL_TimerCallback 

Source
pub type SDL_TimerCallback = Option<unsafe extern "C" fn(userdata: *mut c_void, timerID: SDL_TimerID, interval: Uint32) -> Uint32>;
Expand description

Function prototype for the millisecond timer callback function.

The callback function is passed the current timer interval and returns the next timer interval, in milliseconds. 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

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

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

§Availability

This datatype is available since SDL 3.2.0.

§See also

Aliased Type§

pub enum SDL_TimerCallback {
    None,
    Some(unsafe extern "C" fn(*mut c_void, SDL_TimerID, u32) -> u32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*mut c_void, SDL_TimerID, u32) -> u32)

Some value of type T.