vengine
0.0.1
3D graphics engine
Loading...
Searching...
No Matches
clock.cpp
Go to the documentation of this file.
1
#include "
VEngine/Utils/Clock.hpp
"
2
3
void
ven::Clock::update
()
4
{
5
auto
newTime = std::chrono::high_resolution_clock::now();
6
m_deltaTime
= newTime -
m_startTime
;
7
m_startTime
= newTime;
8
}
9
10
void
ven::Clock::stop
()
11
{
12
if
(m_isStopped) {
13
return
;
14
}
15
16
m_stopTime = std::chrono::high_resolution_clock::now();
17
m_isStopped =
true
;
18
}
19
20
void
ven::Clock::resume
()
21
{
22
if
(!m_isStopped) {
23
return
;
24
}
25
26
m_startTime += std::chrono::high_resolution_clock::now() - m_stopTime;
27
m_isStopped =
false
;
28
}
Clock.hpp
This file contains the Clock class.
ven::Clock::m_deltaTime
std::chrono::duration< float > m_deltaTime
Definition
Clock.hpp:46
ven::Clock::m_startTime
TimePoint m_startTime
Definition
Clock.hpp:44
ven::Clock::update
void update()
Definition
clock.cpp:3
ven::Clock::stop
void stop()
Definition
clock.cpp:10
ven::Clock::resume
void resume()
Definition
clock.cpp:20
src
Utils
clock.cpp
Generated by
1.11.0