aboutsummaryrefslogtreecommitdiff
path: root/src/engine/engine.hpp
blob: 82bde16fb7f5725bcda6b7819243af16e32ac479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include <memory>
#include <unordered_map>
#include <yacppdic/auto_wirable.hpp>

#include "interfaces/component_renderer.hpp"
#include "interfaces/cursor.hpp"
#include "interfaces/engine.hpp"
#include "interfaces/game.hpp"
#include "interfaces/input.hpp"
#include "interfaces/scene.hpp"

class ICursorController;
class IScene;
class IUserInputObserver;

constexpr auto MIN_TIME_SINCE_LAST_UPDATE_MILLIS = 15;

class CLIGameEngine : public ICLIGameEngine,
					  public yacppdic::AutoWirable<
						  ICLIGameEngine,
						  CLIGameEngine,
						  IGameFactory,
						  IComponentRendererFactory,
						  IUserInputObserver,
						  ICursorController,
						  IScene>
{
public:
	CLIGameEngine(
		IGameFactory game_factory,
		IComponentRendererFactory component_renderer_factory,
		std::shared_ptr<IUserInputObserver> user_input_observer,
		std::shared_ptr<ICursorController> cursor_controller,
		std::shared_ptr<IScene> scene) noexcept;

	void start() noexcept override;

private:
	IGameFactory _game_factory;
	IComponentRendererFactory _component_renderer_factory;

	std::shared_ptr<IUserInputObserver> _user_input_observer;
	std::shared_ptr<ICursorController> _cursor_controller;
	std::shared_ptr<IScene> _scene;
};