|
MochiEngine
|
Class that provides several time values useful for game development. More...
#include <TimeSystem.h>
Public Member Functions | |
| TimeSystem (TimeSystem const &)=delete | |
| void | operator= (TimeSystem const &)=delete |
| void | Tick (const float &dt) |
Static Public Member Functions | |
| static TimeSystem & | GetInstance () |
| static float | GetDeltaTime () |
| Gets the last delta time, scaled by the time scale. | |
| static float | GetUnscaledDeltaTime () |
| Gets the last delta time without scale. | |
| static float | GetGameTime () |
| Gets the time passed since opening the application, scaled. | |
| static float | GetUnscaledGameTime () |
| Gets the time passed since opening the application. | |
| static void | SetTimeScale (const float &scale) |
| Sets a time scale. | |
| static float | GetTimeScale () |
| Gets the current time scale. | |
Class that provides several time values useful for game development.
This class has to be updated calling Tick with the real delta time passed since the last frame. This way, TimeSystem stores it, applies time scale if needed and updated the total time passed since the application started.
Guarantees:
Thread safety:
|
static |
Gets the last delta time, scaled by the time scale.
|
static |
Gets the time passed since opening the application, scaled.
|
static |
Gets the current time scale.
|
static |
Gets the last delta time without scale.
|
static |
Gets the time passed since opening the application.
|
static |
Sets a time scale.
| scale | The new time scale, greater or equal than 0 |