SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Flush()

void Spices::TimeStep::Flush ( )

Refresh time in each engine loop.

Recording the current time.

Calculate frmae time.

Calculate game time.

Setting current time.

Update frames.

Recording the current time.

Calculate frmae time.

Calculate game time.

Setting current time.

Update frames.

Definition at line 26 of file TimeStep.cpp.

27 {
29
33 const auto nowTime = std::chrono::high_resolution_clock::now();
34
38 m_FrameTime = std::chrono::duration<float, std::chrono::seconds::period>(nowTime - m_LastTime).count();
39
43 m_GameTime = std::chrono::duration<float, std::chrono::seconds::period>(nowTime - m_StartTime).count();
44
48 m_LastTime = nowTime;
49
53 ++m_Frames;
54 m_Frames %= UINT64_MAX;
55 }
#define SPICES_PROFILE_ZONE
float m_FrameTime
time step(s) during frames.
Definition TimeStep.h:85
std::chrono::steady_clock::time_point m_StartTime
Engine Start time.
Definition TimeStep.h:75
std::chrono::steady_clock::time_point m_LastTime
Last frame time.
Definition TimeStep.h:80
float m_GameTime
time step(s) since Engine Start.
Definition TimeStep.h:90
uint64_t m_Frames
Frames since Engine Start.
Definition TimeStep.h:95

References m_Frames.

Referenced by Spices::Application::Run().