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::render(const WindowSize &windowSize, const Color clearColor, const bool showDebug) const
12{
13 const float dt = m_clock->getDeltaSeconds();
14 m_clock->restart();
15 m_renderer->clearWindow(clearColor);
16 m_sceneManager->getCurrentScene()->updateSystems(dt);
17 m_sceneManager->getCurrentScene()->update(dt, windowSize);
18 if (showDebug)
19 {
20 m_renderer->renderGui(windowSize);
21 }
22 m_renderer->displayWindow();
23}
This file contains the Engine class declaration.
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 render(const WindowSize &windowSize, Color clearColor, bool showDebug) const
Definition engine.cpp:11
Class for managing scenes.