Function add_timer
pub fn add_timer(delay: u32, callback: Box<dyn FnMut() -> u32 + Send>) -> Timer
Available on crate feature
dep_sdl3
only.Expand description
Constructs a new timer using the boxed closure callback
.
The timer is started immediately and will be canceled either:
- When the timer is dropped.
- When the callback returns a non-positive continuation interval.
The callback is run in a thread that is created and managed internally by SDL3 from C. The callback must not panic!