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

#include "interfaces/command.hpp"
#include "interfaces/cursor.hpp"
#include "interfaces/scene.hpp"
#include "interfaces/window.hpp"

#include <yacppdic/factory.hpp>

#include <memory>
#include <unordered_map>

// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class IGame
{
public:
	virtual ~IGame() noexcept = default;

	virtual void on_start() noexcept = 0;

	virtual void on_update() noexcept = 0;

	virtual void on_exit() const noexcept = 0;

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

/*
using IGameFactory = std::unique_ptr<IGame> (*)(
	const std::shared_ptr<IWindow> &window, const std::shared_ptr<IScene> &scene,
	const std::shared_ptr<ICursorController> &cursor_controller);
	*/

using IGameFactory = yacppdic::Factory<std::unique_ptr<IGame>(
	const std::shared_ptr<IWindow> &window,
	const std::shared_ptr<IScene> &scene,
	const std::shared_ptr<ICursorController> &cursor_controller)>;