Definition at line 15 of file timer_class.h.
◆ timer_class() [1/2]
timer_class::timer_class |
( |
| ) |
|
◆ timer_class() [2/2]
◆ ~timer_class()
timer_class::~timer_class |
( |
| ) |
|
◆ Frame()
void timer_class::Frame |
( |
| ) |
|
Definition at line 44 of file timer_class.cpp.
45{
46 INT64 currentTime;
47 INT64 elapsedTicks;
48
49
50
51 QueryPerformanceCounter((LARGE_INTEGER*)¤tTime);
52
53
54 elapsedTicks = currentTime - m_startTime;
55
56
57 m_frameTime = (float)elapsedTicks / m_frequency;
58
59
60 m_startTime = currentTime;
61
62 return;
63}
◆ GetTime()
float timer_class::GetTime |
( |
| ) |
|
◆ Initialize()
bool timer_class::Initialize |
( |
| ) |
|
Definition at line 18 of file timer_class.cpp.
19{
20 Logger::Get().
Log(
"Initilazing timer class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
21
22 INT64 frequency;
23
24
25
26 QueryPerformanceFrequency((LARGE_INTEGER*)&frequency);
27 if (frequency == 0)
28 {
29 Logger::Get().
Log(
"QueryPerformanceFrequency failed", __FILE__, __LINE__, Logger::LogLevel::Error);
30 return false;
31 }
32
33
34 m_frequency = (float)frequency;
35
36
37 QueryPerformanceCounter((LARGE_INTEGER*)&m_startTime);
38
39 Logger::Get().
Log(
"Timer class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
40
41 return true;
42}
void Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
The documentation for this class was generated from the following files: