#include <timer.h>
Definition at line 17 of file timer.h.
◆ timer()
Timer default constructor.
Definition at line 16 of file timer.cpp.
17{
18 LastFpsCalcutionTime = OldTime = StartTime = high_resolution_clock::now();
19}
◆ Get()
- Global timer getter function.
- Parameters
-
- Returns
- None.
Definition at line 71 of file timer.h.
71{ return GlobalTimerInstance; }
◆ GetDeltaTime()
static float scl::timer::GetDeltaTime |
( |
| ) |
|
|
inlinestatic |
Inter-frame delta time getter function.
Definition at line 42 of file timer.h.
42{ return GlobalTimerInstance->DeltaTime; }
◆ GetFps()
static float scl::timer::GetFps |
( |
| ) |
|
|
inlinestatic |
Frames per second count getter function.
Definition at line 44 of file timer.h.
44{ return GlobalTimerInstance->Fps; }
◆ GetIsPause()
static bool scl::timer::GetIsPause |
( |
| ) |
|
|
inlinestatic |
Timer update delay in seconds.
Is timer paused flag getter function.
Definition at line 38 of file timer.h.
38{ return GlobalTimerInstance->IsPause; }
◆ GetTime()
static float scl::timer::GetTime |
( |
| ) |
|
|
inlinestatic |
Current time since 1970 1st Jan getter function.
Definition at line 40 of file timer.h.
40{ return GlobalTimerInstance->Time; }
◆ Response()
void scl::timer::Response |
( |
| ) |
|
- Timer response function. Calculate inter-frame delta time each call, but FPS only once second.
- Parameters
-
- Returns
- None.
Definition at line 21 of file timer.cpp.
22{
23 time_point current_time = high_resolution_clock::now();
24 Time = duration<float>(current_time - StartTime).count();
25
26 LastFpsCalcutionFramesCount++;
27 float fps_calculation_delta_time = duration<float>(current_time - LastFpsCalcutionTime).count();
29 {
30 Fps = LastFpsCalcutionFramesCount / fps_calculation_delta_time;
31 LastFpsCalcutionTime = high_resolution_clock::now();
32 LastFpsCalcutionFramesCount = 0;
33 }
34
35 DeltaTime = duration<float>(current_time - OldTime).count();
36 OldTime = current_time;
37}
static const float UpdateDelay
◆ SetIsPause()
static void scl::timer::SetIsPause |
( |
bool |
IsPause | ) |
|
|
inlinestatic |
Is timer paused flag setter function.
Definition at line 47 of file timer.h.
47{ GlobalTimerInstance->IsPause = IsPause; }
◆ SwitchIsPause()
static void scl::timer::SwitchIsPause |
( |
| ) |
|
|
inlinestatic |
Is timer paused flag toffle function.
Definition at line 49 of file timer.h.
49{ GlobalTimerInstance->IsPause = !GlobalTimerInstance->IsPause; }
◆ UpdateDelay
const float scl::timer::UpdateDelay = 0.2f |
|
static |
Timer getter/setter functions.
Definition at line 35 of file timer.h.
The documentation for this class was generated from the following files: