1 | #ifndef TIMER_SDL2_HPP_ |
2 | #define TIMER_SDL2_HPP_ |
3 |
|
4 |
|
5 | #include "IUpdateable.hpp" |
6 | #include "ITimer.hpp" |
7 |
|
8 |
|
9 | class TimerSDL2 : public ITimer |
10 | { |
11 | public: |
12 | // TimerSDL2 |
13 | TimerSDL2(); |
14 | ~TimerSDL2() = default; |
15 |
|
16 | // IUpdateable |
17 | bool Update() override; |
18 |
|
19 | // ITimer |
20 | void Reset() override; |
21 | void SetTimeout(uint64_t timeout_ms) override; |
22 | void Start() override; |
23 | void Stop() override; |
24 | bool IsExpired() override; |
25 | uint64_t *GetGlobalTimePointer() override; |
26 |
|
27 | private: |
28 | static uint64_t s_globalCounterMs; |
29 | static bool s_globalCounterInitialized; |
30 |
|
31 | uint64_t m_instanceStartTimeMs; |
32 | uint64_t m_instanceTimeoutMs; |
33 | bool m_instanceRunning; |
34 | bool m_instanceExpired; |
35 | }; |
36 |
|
37 |
|
38 | #endif /* TIMER_SDL2_HPP_ */ |
39 |
|