A GameTimer is responsible for managing everything that is connected with time, ticks, elapsed time since start, deltaTime. There can only be one GameTimer.
More...
#include <Time.hpp>
|
| | ~GameTimer ()=default |
| void | SetTickrate (const uint16_t tickrate) |
| | Changes the tickrate.
|
| double | GetDeltaTime () const |
| | Returns the deltaTime, scale is in seconds.
|
| double | GetTickAlpha () const |
| | Returns the tickAlpha, scale is in seconds. Used for between tick interpolation.
|
| float | GetTimestep () const |
| | Returns the current timeStep, scale is in seconds.
|
| uint16_t | GetTickRate () const |
| | Returns the current tickRate.
|
| double | GetElapsedMilliseconds () const |
| | Gets the time in milliseconds since application start.
|
| double | GetElapsedSeconds () const |
| | Gets the time in seconds since application start.
|
| double | GetElapsedMinutes () const |
| | Gets the time in minutes since application start.
|
| double | GetElapsedHours () const |
| | Gets the time in hours since application start.
|
| void | SetManualTickStep (const bool state) |
| | Enables or disables manual tick step.
|
|
| static std::string | FormatTime_MS_to_M_S_MS (const double milliseconds) |
| | Formats milliseconds into a string with a format Min:Sec:Ms.
|
| static std::string | FormatTime_S_to_M_S_MS (const double seconds) |
| | Formats seconds into a string with a format Min:Sec:Ms.
|
A GameTimer is responsible for managing everything that is connected with time, ticks, elapsed time since start, deltaTime. There can only be one GameTimer.
Definition at line 8 of file Time.hpp.
◆ ~GameTimer()
| Cori::Core::GameTimer::~GameTimer |
( |
| ) |
|
|
default |
◆ FormatTime_MS_to_M_S_MS()
| std::string Cori::Core::GameTimer::FormatTime_MS_to_M_S_MS |
( |
const double | milliseconds | ) |
|
|
staticnodiscard |
Formats milliseconds into a string with a format Min:Sec:Ms.
- Parameters
-
| milliseconds | Value to convert. |
- Returns
- Formated string.
Definition at line 12 of file Time.cpp.
◆ FormatTime_S_to_M_S_MS()
| std::string Cori::Core::GameTimer::FormatTime_S_to_M_S_MS |
( |
const double | seconds | ) |
|
|
staticnodiscard |
Formats seconds into a string with a format Min:Sec:Ms.
- Parameters
-
- Returns
- Formated string.
Definition at line 20 of file Time.cpp.
◆ GetDeltaTime()
| double Cori::Core::GameTimer::GetDeltaTime |
( |
| ) |
const |
|
inlinenodiscard |
Returns the deltaTime, scale is in seconds.
Definition at line 21 of file Time.hpp.
◆ GetElapsedHours()
| double Cori::Core::GameTimer::GetElapsedHours |
( |
| ) |
const |
|
inlinenodiscard |
Gets the time in hours since application start.
- Returns
- Hours elapsed.
Definition at line 60 of file Time.hpp.
◆ GetElapsedMilliseconds()
| double Cori::Core::GameTimer::GetElapsedMilliseconds |
( |
| ) |
const |
|
inlinenodiscard |
Gets the time in milliseconds since application start.
- Returns
- Milliseconds elapsed.
Definition at line 42 of file Time.hpp.
◆ GetElapsedMinutes()
| double Cori::Core::GameTimer::GetElapsedMinutes |
( |
| ) |
const |
|
inlinenodiscard |
Gets the time in minutes since application start.
- Returns
- Minutes elapsed.
Definition at line 54 of file Time.hpp.
◆ GetElapsedSeconds()
| double Cori::Core::GameTimer::GetElapsedSeconds |
( |
| ) |
const |
|
inlinenodiscard |
Gets the time in seconds since application start.
- Returns
- Seconds elapsed.
Definition at line 48 of file Time.hpp.
◆ GetTickAlpha()
| double Cori::Core::GameTimer::GetTickAlpha |
( |
| ) |
const |
|
inlinenodiscard |
Returns the tickAlpha, scale is in seconds. Used for between tick interpolation.
Definition at line 26 of file Time.hpp.
◆ GetTickRate()
| uint16_t Cori::Core::GameTimer::GetTickRate |
( |
| ) |
const |
|
inlinenodiscard |
Returns the current tickRate.
Definition at line 36 of file Time.hpp.
◆ GetTimestep()
| float Cori::Core::GameTimer::GetTimestep |
( |
| ) |
const |
|
inlinenodiscard |
Returns the current timeStep, scale is in seconds.
Definition at line 31 of file Time.hpp.
◆ SetManualTickStep()
| void Cori::Core::GameTimer::SetManualTickStep |
( |
const bool | state | ) |
|
Enables or disables manual tick step.
- Parameters
-
When enabled ticks don't happened on their own, instead you can advance one tick at a time by pressing K, or hold J to enable regular behaviour when enabled.
- Note
- When using manual step interpolation might look wierd, since m_TickAlpha will be close to 0 all the time.
This is expected behaviour since it relies on per frame logic, but what we do when using manual step is we advance one tick at a time including running the per frame logic not each frame. Interpolated position would look like similar to the case if we would run the game at near tickrate FPS.
Definition at line 24 of file Time.cpp.
◆ SetTickrate()
| void Cori::Core::GameTimer::SetTickrate |
( |
const uint16_t | tickrate | ) |
|
Changes the tickrate.
- Parameters
-
Definition at line 83 of file Time.cpp.
◆ Application
The documentation for this class was generated from the following files: