SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Timer.hpp
Go to the documentation of this file.
1#ifndef _TIMER_HPP_
2#define _TIMER_HPP_
3
4#include <chrono>
5
6namespace Sleak {
7 /// Wall-clock stopwatch built on std::chrono. Application keeps one for
8 /// frame delta time.
9 /// @ingroup core
10 class Timer {
11 public:
12 Timer();
13
14 /// Restarts the clock at zero.
15 void Reset();
16
17 /// Seconds since construction or the last Reset().
18 float Elapsed() const;
19
20 private:
21 std::chrono::time_point<std::chrono::high_resolution_clock> startPoint;
22 };
23};
24
25#endif
void Reset()
Restarts the clock at zero.
Definition Timer.cpp:8
float Elapsed() const
Seconds since construction or the last Reset().
Definition Timer.cpp:13
Root namespace for everything the engine exposes.
Definition Camera.hpp:10