r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
Engine.hpp
Go to the documentation of this file.
1///
2/// @file Engine.hpp
3/// @brief This file contains the Engine class declaration
4/// @namespace eng
5///
6
7#pragma once
8
9#include <functional>
10#include <memory>
11
13#include "Interfaces/IAudio.hpp"
16#include "Utils/Clock.hpp"
17
18namespace eng
19{
20
21 enum State : unsigned char
22 {
23 STOP = 0,
24 RUN = 1,
26 };
27
28 ///
29 /// @class Engine
30 /// @brief Class for the engine
31 /// @namespace eng
32 ///
34 {
35
36 public:
37 Engine(const std::function<std::shared_ptr<IAudio>()> &audioFactory,
38 const std::function<std::shared_ptr<INetworkClient>()> &networkFactory,
39 const std::function<std::shared_ptr<IRenderer>()> &rendererFactory);
40 ~Engine() = default;
41
42 Engine(const Engine &) = delete;
43 Engine &operator=(const Engine &) = delete;
44 Engine(Engine &&) = delete;
45 Engine &operator=(Engine &&) = delete;
46
47 std::shared_ptr<IAudio> &getAudio() { return m_audio; }
48 std::shared_ptr<INetworkClient> &getNetwork() { return m_network; }
49 std::shared_ptr<IRenderer> &getRenderer() { return m_renderer; }
50 std::unique_ptr<utl::Clock> &getClock() { return m_clock; }
51 std::unique_ptr<SceneManager> &getSceneManager() { return m_sceneManager; }
52 State getState() const { return m_state; }
53
54 void setState(const State newState) { m_state = newState; }
55
56 void render(const WindowSize &windowSize, Color clearColor, bool showDebug) const;
57 void stop() const { m_renderer->closeWindow(); }
58
59 private:
60 State m_state = RUN;
61 std::unique_ptr<utl::Clock> m_clock;
62 std::unique_ptr<SceneManager> m_sceneManager;
63 std::shared_ptr<IAudio> m_audio;
64 std::shared_ptr<INetworkClient> m_network;
65 std::shared_ptr<IRenderer> m_renderer;
66 }; // class Engine
67} // namespace eng
This file contains the Clock class.
This file contains the Audio interface.
This file contains the client network interface.
#define PLUGIN_EXPORT
Definition IPlugin.hpp:15
This file contains the IRenderer class declaration.
Class for the engine.
Definition Engine.hpp:34
std::shared_ptr< IAudio > & getAudio()
Definition Engine.hpp:47
std::unique_ptr< utl::Clock > & getClock()
Definition Engine.hpp:50
std::shared_ptr< IRenderer > & getRenderer()
Definition Engine.hpp:49
std::unique_ptr< utl::Clock > m_clock
Definition Engine.hpp:61
std::shared_ptr< INetworkClient > m_network
Definition Engine.hpp:64
std::shared_ptr< IRenderer > m_renderer
Definition Engine.hpp:65
void setState(const State newState)
Definition Engine.hpp:54
~Engine()=default
void stop() const
Definition Engine.hpp:57
State getState() const
Definition Engine.hpp:52
Engine(Engine &&)=delete
Engine(const Engine &)=delete
std::unique_ptr< SceneManager > & getSceneManager()
Definition Engine.hpp:51
std::unique_ptr< SceneManager > m_sceneManager
Definition Engine.hpp:62
Engine & operator=(const Engine &)=delete
Engine & operator=(Engine &&)=delete
std::shared_ptr< IAudio > m_audio
Definition Engine.hpp:63
std::shared_ptr< INetworkClient > & getNetwork()
Definition Engine.hpp:48
This file contains the SceneManager class declaration.
State
Definition Engine.hpp:22
@ STOP
Definition Engine.hpp:23
@ RUN
Definition Engine.hpp:24
@ DEFAULT
Definition Engine.hpp:25