Index

zydeco / 0dd781a

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
405 Aug 2023 20:500dd781aCreate event handling and threads structureJosh Stockin12910G

Blob @ zydeco / include / Engine.hpp

text/plain1017 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 Start();
27 void Kill();
28
29protected:
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