1 | #ifndef ENGINE_HPP_ |
2 | #define ENGINE_HPP_ |
3 |
|
4 |
|
5 | #include <chrono> |
6 | #include <atomic> |
7 | #include <map> |
8 | #include <thread> |
9 |
|
10 | #include "ZydecoCommon.hpp" |
11 | #include "IEventQuitSubscriber.hpp" |
12 |
|
13 |
|
14 | class IEventHandler; |
15 | class IWindow; |
16 |
|
17 |
|
18 | class Engine : public IEventQuitSubscriber |
19 | { |
20 | public: |
21 | Engine(IEventHandler& r_event_handler, IWindow& r_window); |
22 | ~Engine(); |
23 |
|
24 | void OnQuitEvent() override; |
25 |
|
26 | void Start(); |
27 | void Kill(); |
28 |
|
29 | protected: |
30 | IEventHandler& m_rEventHandler; |
31 | IWindow& m_rWindow; |
32 |
|
33 | std::chrono::time_point<std::chrono::steady_clock, std::chrono::microseconds> m_currentTime; |
34 |
|
35 | std::atomic<bool> m_aIsExiting; |
36 | std::map<std::string, std::thread*> m_threads; |
37 | void DoEventLoop(); |
38 | void DoRenderLoop(); |
39 |
|
40 | std::chrono::time_point<std::chrono::steady_clock, std::chrono::microseconds> m_frameRenderStartTime; |
41 | double m_framerate; |
42 | std::chrono::microseconds m_frameRenderTimeUs; |
43 | /* Scene m_scene; |
44 | Renderer m_renderer; |
45 | EventHandler m_eventHandler;*/ |
46 | }; |
47 |
|
48 |
|
49 | #endif /* ENGINE_HPP_ */ |
50 |
|