Index

zydeco / 3c60e1a

Experiment in graphics programming, C++, OpenGL, simulation techniques.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
505 Aug 2023 23:143c60e1aUse GL3WJosh Stockin158G

Blob @ zydeco / include / Engine.hpp

text/plain960 bytesdownload raw
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
14class IEventHandler;
15class IWindow;
16
17
18class Engine : public IEventQuitSubscriber
19{
20public:
21 Engine(IEventHandler& r_event_handler, IWindow& r_window);
22 ~Engine();
23
24 void OnQuitEvent() override;
25
26 void Execute();
27
28protected:
29 IEventHandler& m_rEventHandler;
30 IWindow& m_rWindow;
31
32 std::atomic<bool> m_aIsExiting;
33 std::atomic<bool> m_aSceneUpdated;
34 std::map<std::string, std::thread*> m_threads;
35 void DoEventLoop();
36 void DoRenderLoop();
37
38 std::chrono::time_point<std::chrono::steady_clock, std::chrono::microseconds> m_currentTime;
39
40 double m_framerate;
41 std::chrono::microseconds m_frameRenderTimeUs;
42 std::chrono::time_point<std::chrono::steady_clock, std::chrono::microseconds> m_frameRenderStartTime;
43};
44
45
46#endif /* ENGINE_HPP_ */
47