[−][src]Struct riddle_time::TimeSystemHandle
Implementations
impl TimeSystemHandle
[src]
pub fn downgrade(this: &TimeSystemHandle) -> TimeSystemWeak
[src]
Downgrade this handle to a weak handle
pub fn eq(a: &TimeSystemHandle, b: &TimeSystemHandle) -> bool
[src]
Test whether two handles point to the same location in memory
Methods from Deref<Target = TimeSystem>
pub fn process_frame(&self)
[src]
Update the time system state, marking the beginning of a the next frame.
The instant that this method is called is taken as the reference time for the frame that is about to be executed.
Timers will also be triggered during this function call if they are due to trigger.
Do not call this function directly if you are using this through the
riddle
crate.
Example
let frame_1 = time_system.frame_instant(); // A while later let frame_n = time_system.frame_instant(); assert_eq!(true, frame_n - frame_1 > std::time::Duration::from_secs(0));
pub fn fps(&self) -> f32
[src]
Get the current FPS as calculated based on previous frame durations.
pub fn delta_secs(&self) -> f32
[src]
Get the current delta t as calculated based on previous frame durations.
pub fn frame_instant(&self) -> Instant
[src]
Get the reference time for this frame. Captured during TimeSystem::process_frame
.
pub fn register_timer<F>(&self, duration: Duration, callback: F) -> TimerHandle where
F: FnOnce() + Send + 'static,
[src]
F: FnOnce() + Send + 'static,
Register a timer with a callback which will be fired when the time elpases.
The returned handle may be dropped without cancelling the timer.
Example
let val = Arc::new(AtomicBool::new(false)); time_system.register_timer(std::time::Duration::from_millis(200), { let val = val.clone(); move || { val.store(true, Ordering::Relaxed); } }); // A while later assert_eq!(true, val.load(Ordering::Relaxed));
Trait Implementations
impl Clone for TimeSystemHandle
[src]
fn clone(&self) -> TimeSystemHandle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Deref for TimeSystemHandle
[src]
Auto Trait Implementations
impl RefUnwindSafe for TimeSystemHandle
impl Send for TimeSystemHandle
impl Sync for TimeSystemHandle
impl Unpin for TimeSystemHandle
impl UnwindSafe for TimeSystemHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,