pub struct FrameTimer { /* private fields */ }Expand description
Frame time tracker for computing frame statistics.
Implementations§
Source§impl FrameTimer
impl FrameTimer
Sourcepub const fn with_fixed_dt(fixed_dt: f64) -> Self
pub const fn with_fixed_dt(fixed_dt: f64) -> Self
Creates a frame timer with custom fixed timestep.
Sourcepub fn set_max_dt(&mut self, max_dt: f64)
pub fn set_max_dt(&mut self, max_dt: f64)
Sets the maximum allowed delta time.
Sourcepub fn set_fixed_dt(&mut self, fixed_dt: f64)
pub fn set_fixed_dt(&mut self, fixed_dt: f64)
Sets the fixed timestep interval.
Sourcepub fn consume_fixed_step(&mut self) -> Option<f64>
pub fn consume_fixed_step(&mut self) -> Option<f64>
Sourcepub fn interpolation_alpha(&self) -> f64
pub fn interpolation_alpha(&self) -> f64
Returns the interpolation alpha for rendering between physics steps.
This value (0.0 to 1.0) indicates how far between the last and next physics step we are, useful for interpolating visual positions.
Sourcepub const fn total_time(&self) -> f64
pub const fn total_time(&self) -> f64
Returns the total elapsed time since the timer was created.
Sourcepub const fn frame_count(&self) -> u64
pub const fn frame_count(&self) -> u64
Returns the total number of frames processed.
Sourcepub fn average_fps(&self) -> f64
pub fn average_fps(&self) -> f64
Returns the average frames per second.
Sourcepub const fn accumulator(&self) -> f64
pub const fn accumulator(&self) -> f64
Returns the remaining accumulator time.
Trait Implementations§
Source§impl Clone for FrameTimer
impl Clone for FrameTimer
Source§fn clone(&self) -> FrameTimer
fn clone(&self) -> FrameTimer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FrameTimer
impl Debug for FrameTimer
Auto Trait Implementations§
impl Freeze for FrameTimer
impl RefUnwindSafe for FrameTimer
impl Send for FrameTimer
impl Sync for FrameTimer
impl Unpin for FrameTimer
impl UnwindSafe for FrameTimer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more