1 #ifndef GAME_CLOCK_HXX_
2 #define GAME_CLOCK_HXX_
7 #include "../util/PriorityQueue.hxx"
8 #include "../util/Singleton.hxx"
10 using namespace std::chrono_literals;
21 using Clock = std::chrono::high_resolution_clock;
61 template <
typename DelayType,
typename PeriodType = TimePo
int>
81 void setGameClockSpeed(
float speedFactor);
96 bool removeClockTask(ClockTaskHndl hndl);
102 static constexpr
unsigned int DefaultGameTickDuration = 2000;
112 template <
typename Time,
typename Duration>
struct ClockTask
120 : callback{cbk}, m_waketime{delay}, m_period{period}, hndl{hndl}
142 float m_speedFactor = 1.f;
143 Clock::duration m_gameTickDuration = std::chrono::milliseconds(DefaultGameTickDuration);
155 #endif // GAME_CLOCK_HXX_