| 1 | = Clock = |
| 2 | |
| 3 | The clock class serves as an object that distributes time. It is created in RootGameState at the very beginning of start() which denotes the start of the game. [[br]] |
| 4 | The capture() method then saves the current time. It can only be called by RootGameState.[[br]] |
| 5 | In Order to get the current time, call getMicroseconds() and you will get the time stored by capture(). If you want to receive the current real time, call getRealMicroseconds(). This doesn't store the time however.[[br]] |
| 6 | [[br]] |
| 7 | The idea is that the Clock object is handed over to every GameState via constant reference in the tick() method.[br] |
| 8 | You should not attempt to use the Clock for the game level time. There is another class for that, which gets ticked too. [[br]] |
| 9 | [[br]] |
| 10 | |
| 11 | || Method || Description || |
| 12 | |||||| |
| 13 | || getMicroseconds || Absolute time since start() in us (stored) || |
| 14 | || getMilliseconds || Absolute time since start() in ms (stored) || |
| 15 | || getSeconds || Absolute time since start() in seconds (rounded, stored) || |
| 16 | || getSecondsPrecise || Absolute time since start() in seconds as floating point number (stored) || |
| 17 | || getDeltaTime || Relative time between the last two capture() calls in seconds as floating point number (stored) || |
| 18 | || getDeltaTimeMicroseconds || Relative time between the last two capture() calls in micro seconds (stored) || |
| 19 | || getRealMicroseconds || Absolute time since start() in us (not stored) || |