aboutsummaryrefslogtreecommitdiff
path: root/src/engine/engine.hpp
blob: 7b322b56e97a6ecf0a2cb058a7381f018c3b3519 (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
#pragma once

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

#include <yacppdic/auto_wirable.hpp>

#include <memory>
#include <unordered_map>

class CLIGameEngine : public ICLIGameEngine,
					  public yacppdic::AutoWirable<
						  ICLIGameEngine,
						  CLIGameEngine,
						  IGameFactory,
						  ISceneFactory,
						  IInputHandler,
						  ICursorController>
{
public:
	CLIGameEngine(
		IGameFactory game_factory,
		ISceneFactory scene_factory,
		std::shared_ptr<IInputHandler> input_handler,
		std::shared_ptr<ICursorController> cursor_controller) noexcept;

	void start() noexcept override;

private:
	IGameFactory _game_factory;
	ISceneFactory _scene_factory;

	std::shared_ptr<IInputHandler> _input_handler;
	std::shared_ptr<ICursorController> _cursor_controller;

	void _configure_input(
		const std::unordered_map<char, std::shared_ptr<ICommand>> &input_config) noexcept;
};