3#include <Foundation/Time/Clock.h>
17 m_pTimeStepSmoother = pSmoother;
19 if (m_pTimeStepSmoother)
20 m_pTimeStepSmoother->
Reset(
this);
25 return m_pTimeStepSmoother;
33 if (bPaused && m_pTimeStepSmoother)
34 m_pTimeStepSmoother->
Reset(
this);
44 return m_FixedTimeStep;
49 return m_AccumulatedTime;
54 return m_LastTimeDiff;
88 PL_ASSERT_DEV(m_FixedTimeStep.
GetSeconds() >= 0.0,
"Fixed Time Stepping cannot reverse time!");
90 m_FixedTimeStep = diff;
95 PL_ASSERT_DEV(fFactor >= 0.0,
"Time cannot run backwards.");
plTime GetTimeDiff() const
Returns the time difference between the last two calls to Update().
Definition Clock_inl.h:52
double GetSpeed() const
Returns the clock speed multiplier.
Definition Clock_inl.h:57
plStringView GetClockName() const
Returns the name of the clock. All clocks get default names 'Clock N', unless the user specifies anot...
Definition Clock_inl.h:10
void SetMinimumTimeStep(plTime min)
Sets the minimum time that must pass between clock updates.
Definition Clock_inl.h:62
bool GetPaused() const
Returns the paused state.
Definition Clock_inl.h:37
plTime GetMinimumTimeStep() const
Returns the value for the minimum time step.
Definition Clock_inl.h:76
plTimeStepSmoothing * GetTimeStepSmoothing() const
Returns the object used for time step smoothing (if any).
Definition Clock_inl.h:23
void SetPaused(bool bPaused)
Sets the clock to be paused or running.
Definition Clock_inl.h:28
void SetTimeStepSmoothing(plTimeStepSmoothing *pSmoother)
Sets a time step smoother for this clock. Pass nullptr to deactivate time step smoothing.
Definition Clock_inl.h:15
void SetClockName(plStringView sName)
Sets the name of the clock. Useful to identify the clock in tools such as plInspector.
Definition Clock_inl.h:5
plTime GetAccumulatedTime() const
Returns the accumulated time since the last call to Reset().
Definition Clock_inl.h:47
void SetSpeed(double fFactor)
The factor with which to scale the time step during calls to Update().
Definition Clock_inl.h:93
plTime GetFixedTimeStep() const
Returns the value for the fixed time step (zero if it is disabled).
Definition Clock_inl.h:42
void SetFixedTimeStep(plTime diff=plTime())
Sets a fixed time step for updating the clock.
Definition Clock_inl.h:86
plTime GetMaximumTimeStep() const
Returns the value for the maximum time step.
Definition Clock_inl.h:81
void SetMaximumTimeStep(plTime max)
Sets the maximum time that may pass between clock updates.
Definition Clock_inl.h:69
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Base class for all time step smoothing algorithms.
Definition Clock.h:175
virtual void Reset(const plClock *pClock)=0
Called when plClock::Reset(), plClock::Load() or plClock::SetPaused(true) was called.
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeFromSeconds(double fSeconds)
Creates an instance of plTime that was initialized from seconds.
Definition Time.h:30
constexpr double GetSeconds() const
Returns the seconds value.
Definition Time_inl.h:30