r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
engine.cpp
Go to the documentation of this file.
1#include "Engine/Engine.hpp"
2
3eng::Engine::Engine(const std::function<std::shared_ptr<IAudio>()> &audioFactory,
4 const std::function<std::shared_ptr<INetworkClient>()> &networkFactory,
5 const std::function<std::shared_ptr<IRenderer>()> &rendererFactory)
6 : m_clock(std::make_unique<utl::Clock>()), m_sceneManager(std::make_unique<SceneManager>()),
7 m_audio(audioFactory()), m_network(networkFactory()), m_renderer(rendererFactory())
8{
9}
10
11void eng::Engine::updateSystems(ecs::Registry &registry, const float dt) const
12{
13 for (const auto &system : m_systems)
14 {
15 system->update(registry, dt);
16 }
17}
18
19void eng::Engine::render(ecs::Registry &registry, const Color clearColor, const float dt) const
20{
21 m_renderer->clearWindow(clearColor);
22 updateSystems(registry, dt);
23 m_renderer->displayWindow();
24}
This file contains the Engine class declaration.
Class for managing entities and their components.
Definition Registry.hpp:25
Engine(const std::function< std::shared_ptr< IAudio >()> &audioFactory, const std::function< std::shared_ptr< INetworkClient >()> &networkFactory, const std::function< std::shared_ptr< IRenderer >()> &rendererFactory)
Definition engine.cpp:3
void updateSystems(ecs::Registry &registry, float dt) const
Definition engine.cpp:11
void render(ecs::Registry &registry, Color clearColor, float dt) const
Definition engine.cpp:19
Class for managing scenes.