pub struct TimerSubsystem { /* private fields */ }Implementations§
Source§impl TimerSubsystem
 
impl TimerSubsystem
Sourcepub fn add_timer(&self, delay: u32, callback: TimerCallback) -> Timer<'_>
 
pub fn add_timer(&self, delay: u32, callback: TimerCallback) -> Timer<'_>
Constructs a new timer using the boxed closure callback.
The timer is started immediately, it will be cancelled either:
- when the timer is dropped
- or when the callback returns a non-positive continuation interval
The callback is run in a thread that is created and managed internally by SDL2 from C. If the callback panics, the process will be aborted.
Sourcepub fn ticks(&self) -> u32
 
pub fn ticks(&self) -> u32
Gets the number of milliseconds elapsed since the timer subsystem was initialized.
It’s recommended that you use another library for timekeeping, such as time.
This function is not recommended in upstream SDL2 as of 2.0.18 and internally calls the 64-bit variant and masks the result.
Sourcepub fn ticks64(&self) -> u64
 
pub fn ticks64(&self) -> u64
Gets the number of milliseconds elapsed since the timer subsystem was initialized.
It’s recommended that you use another library for timekeeping, such as time.
Sourcepub fn delay(&self, ms: u32)
 
pub fn delay(&self, ms: u32)
Sleeps the current thread for the specified amount of milliseconds.
It’s recommended that you use std::thread::sleep() instead.
pub fn performance_counter(&self) -> u64
pub fn performance_frequency(&self) -> u64
Trait Implementations§
Source§impl Clone for TimerSubsystem
 
impl Clone for TimerSubsystem
Source§fn clone(&self) -> TimerSubsystem
 
fn clone(&self) -> TimerSubsystem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read more