BRE12
Timer.h
1 #pragma once
2 
3 #include <cstdint>
4 
5 namespace BRE {
9 class Timer {
10 public:
11  Timer();
12  ~Timer() = default;
13  Timer(const Timer&) = delete;
14  const Timer& operator=(const Timer&) = delete;
15  Timer(Timer&&) = delete;
16  Timer& operator=(Timer&&) = delete;
17 
25  __forceinline float GetDeltaTimeInSeconds() const noexcept
26  {
27  return static_cast<float>(mDeltaTimeInSeconds);
28  }
29 
35  void Reset() noexcept;
36 
43  void Tick() noexcept;
44 
45 private:
46  double mSecondsPerCount{ 0.0 };
47  double mDeltaTimeInSeconds{ 0.0 };
48  std::int64_t mStartTickTime{ 0 };
49  std::int64_t mPreviousTickTime{ 0 };
50 };
51 }
52 
Definition: Camera.cpp:8
Timer class used mainly to get frame time.
Definition: Timer.h:9
void Tick() noexcept
Ticks the timer.
Definition: Timer.cpp:25
void Reset() noexcept
Reset timer.
Definition: Timer.cpp:15
__forceinline float GetDeltaTimeInSeconds() const noexcept
Get delta time in seconds.
Definition: Timer.h:25