Struct amethyst_core::timing::Time
source · pub struct Time {
pub last_fixed_update: Instant,
/* private fields */
}
Expand description
Frame timing values.
Fields
last_fixed_update: Instant
Time at which State::fixed_update
was last called.
Implementations
sourceimpl Time
impl Time
sourcepub fn delta_seconds(&self) -> f32
pub fn delta_seconds(&self) -> f32
Gets the time difference between frames in seconds.
sourcepub fn delta_time(&self) -> Duration
pub fn delta_time(&self) -> Duration
Gets the time difference between frames.
sourcepub fn delta_real_seconds(&self) -> f32
pub fn delta_real_seconds(&self) -> f32
Gets the time difference between frames in seconds ignoring the time speed multiplier.
sourcepub fn delta_real_time(&self) -> Duration
pub fn delta_real_time(&self) -> Duration
Gets the time difference between frames ignoring the time speed multiplier.
sourcepub fn fixed_seconds(&self) -> f32
pub fn fixed_seconds(&self) -> f32
Gets the fixed time step in seconds.
sourcepub fn fixed_time(&self) -> Duration
pub fn fixed_time(&self) -> Duration
Gets the fixed time step.
sourcepub fn frame_number(&self) -> u64
pub fn frame_number(&self) -> u64
Gets the current frame number. This increments by 1 every frame. There is no frame 0.
sourcepub fn last_fixed_update(&self) -> Instant
pub fn last_fixed_update(&self) -> Instant
Gets the time at which the last fixed update was called.
sourcepub fn absolute_time(&self) -> Duration
pub fn absolute_time(&self) -> Duration
Gets the time since the start of the game, taking into account the speed multiplier.
sourcepub fn absolute_time_seconds(&self) -> f64
pub fn absolute_time_seconds(&self) -> f64
Gets the time since the start of the game as seconds, taking into account the speed multiplier.
sourcepub fn absolute_real_time(&self) -> Duration
pub fn absolute_real_time(&self) -> Duration
Gets the time since the start of the game, ignoring the speed multiplier.
sourcepub fn absolute_real_time_seconds(&self) -> f64
pub fn absolute_real_time_seconds(&self) -> f64
Gets the time since the start of the game as seconds, ignoring the speed multiplier.
sourcepub fn time_scale(&self) -> f32
pub fn time_scale(&self) -> f32
Gets the current time speed multiplier.
sourcepub fn set_delta_seconds(&mut self, secs: f32)
pub fn set_delta_seconds(&mut self, secs: f32)
Gets the total number of frames that have been played in this session.
Sets both delta_seconds
and delta_time
based on the seconds given.
This should only be called by the engine. Bad things might happen if you call this in your game.
sourcepub fn set_delta_time(&mut self, time: Duration)
pub fn set_delta_time(&mut self, time: Duration)
Sets both delta_time
and delta_seconds
based on the duration given.
This should only be called by the engine. Bad things might happen if you call this in your game.
sourcepub fn set_fixed_seconds(&mut self, secs: f32)
pub fn set_fixed_seconds(&mut self, secs: f32)
Sets both fixed_seconds
and fixed_time
based on the seconds given.
sourcepub fn set_fixed_time(&mut self, time: Duration)
pub fn set_fixed_time(&mut self, time: Duration)
Sets both fixed_time
and fixed_seconds
based on the duration given.
sourcepub fn increment_frame_number(&mut self)
pub fn increment_frame_number(&mut self)
Increments the current frame number by 1.
This should only be called by the engine. Bad things might happen if you call this in your game.
sourcepub fn set_time_scale(&mut self, multiplier: f32)
pub fn set_time_scale(&mut self, multiplier: f32)
Sets the time multiplier that affects how time values are computed, effectively slowing or speeding up your game.
Panics
This will panic if multiplier is NaN, Infinity, or less than 0.
sourcepub fn finish_fixed_update(&mut self)
pub fn finish_fixed_update(&mut self)
Indicates a fixed update just finished.
This should only be called by the engine. Bad things might happen if you call this in your game.
Trait Implementations
impl Copy for Time
impl StructuralPartialEq for Time
Auto Trait Implementations
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations
impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.sourceimpl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
sourcefn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
sourcefn unwrap_default() -> Self
fn unwrap_default() -> Self
try_default
and panics on an error case.