aboutsummaryrefslogtreecommitdiff
path: root/src/game/game.hpp
blob: fb2ad637abc289316f6fd0cce81f5c09219eab6a (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/cursor.hpp"
#include "interfaces/game.hpp"
#include "interfaces/generation_tracker.hpp"
#include "interfaces/scene.hpp"
#include "interfaces/status_manager.hpp"
#include "interfaces/statusline_subscriber_adapter.hpp"

#include <chrono>
#include <memory>

class Game : public IGame
{
public:
	Game(
		std::shared_ptr<IScene> scene,
		std::shared_ptr<ICursorController> cursor_controller,
		std::shared_ptr<IGenerationTracker> generation_tracker,
		std::shared_ptr<IStatusManager> status_manager,
		IStatusLineSubscriberAdapterFactory<Vector2>
			vector2_statusline_subscriber_adapter_factory) noexcept;

	void on_start() noexcept override;

	void on_update() noexcept override;

	void on_exit() const noexcept override;

	[[nodiscard]] auto get_input_config() const noexcept
		-> std::unordered_map<char, std::shared_ptr<ICommand>> override;

private:
	std::shared_ptr<IScene> _scene;
	std::shared_ptr<ICursorController> _cursor_controller;
	std::shared_ptr<IGenerationTracker> _generation_tracker;
	std::shared_ptr<IStatusManager> _status_manager;
	IStatusLineSubscriberAdapterFactory<Vector2>
		_vector2_statusline_subscriber_adapter_factory;

	std::chrono::system_clock::time_point _last_update_time;
};