PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
timer.h
1#pragma once
2
3#include <chrono>
4
5namespace pixelbullet
6{
8class Timer
9{
10public:
11 Timer();
12 ~Timer();
13
15 void Reset();
16
18 float GetElapsedSeconds() const;
19
21 float GetElapsedMilliseconds() const;
22
23private:
24 std::chrono::steady_clock::time_point start_;
25};
26} // namespace pixelbullet
A high-resolution timer for measuring elapsed time.
Definition timer.h:9
float GetElapsedMilliseconds() const
Returns the elapsed time (in milliseconds) since the last Reset.
Definition timer.cc:26
float GetElapsedSeconds() const
Returns the elapsed time (in seconds) since the last Reset.
Definition timer.cc:19
void Reset()
Resets the timer to the current time.
Definition timer.cc:14