High-resolution clock for timing and frame rate management.
More...
#include <aeongames/Clock.hpp>
High-resolution clock for timing and frame rate management.
Definition at line 30 of file Clock.hpp.
◆ Clock() [1/2]
| AeonGames::Clock::Clock |
( |
| ) |
|
Construct a clock with local time 0.
Definition at line 22 of file Clock.cpp.
◆ Clock() [2/2]
| AeonGames::Clock::Clock |
( |
double | starttime | ) |
|
|
explicit |
Construct a clock with a provided local time.
- Parameters
-
| starttime | [in] starting time for the clock. |
Definition at line 26 of file Clock.cpp.
◆ GetDelta() [1/2]
| double AeonGames::Clock::GetDelta |
( |
const Clock & | clock | ) |
|
Get The difference between this clock and another clock in seconds and fraction.
- Parameters
-
| clock | [in] Clock to get the delta from. |
- Returns
- delta clock time in seconds.
Definition at line 38 of file Clock.cpp.
◆ GetDelta() [2/2]
| double AeonGames::Clock::GetDelta |
( |
const uint64_t & | start_time | ) |
|
Get The difference between this clock and a previously recorded time in seconds and fraction.
- Parameters
-
| start_time | [in] previously recorded time in nanoseconds. |
- Returns
- delta clock time in seconds.
Definition at line 43 of file Clock.cpp.
◆ GetTime()
| uint64_t AeonGames::Clock::GetTime |
( |
| ) |
const |
Get The current time for the clock in nanoseconds
- Returns
- Absolute clock time in nanoseconds.
Definition at line 33 of file Clock.cpp.
◆ GetTimeScale()
| double AeonGames::Clock::GetTimeScale |
( |
| ) |
|
Query time scale.
- Returns
- clock time scale.
Definition at line 71 of file Clock.cpp.
◆ IsPaused()
| bool AeonGames::Clock::IsPaused |
( |
| ) |
|
Query for the pause status of the clock.
Definition at line 61 of file Clock.cpp.
◆ Pause()
| void AeonGames::Clock::Pause |
( |
bool | pause = true | ) |
|
Pause or resume clock depending on the parameter.
- Parameters
-
| pause | [in] Boolean specifing if the clock is to be paused or resumed. |
- Note
- Multiple calls passing the same value for the pause parameter will have no effect past the first one.
Definition at line 56 of file Clock.cpp.
◆ SetTimeScale()
| void AeonGames::Clock::SetTimeScale |
( |
double | timescale | ) |
|
Set the time scale. By default the time scale is set to no scale (1.0), this scale can be changed for a number higher than 1.0 to speed up time or less than 1.0 to slow it down, scale can also be set to a negative number in which case time runs backwards or set to zero which frezes time.
- Parameters
-
| timescale | [in] scale to set the clock to. |
Definition at line 66 of file Clock.cpp.
◆ SingleStep()
| void AeonGames::Clock::SingleStep |
( |
| ) |
|
Single step the clock when paused.
This function only takes effect when the clock is paused, its uses are better suited for debugging rather than gameplay.
Definition at line 76 of file Clock.cpp.
◆ Update()
| void AeonGames::Clock::Update |
( |
double | seconds | ) |
|
Update the clock local time.
- Parameters
-
| seconds | [in] Elapsed time since last call in seconds and fraction. |
Definition at line 48 of file Clock.cpp.
The documentation for this class was generated from the following files: