Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
System.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <algorithm>
4#include <entt/entt.hpp>
5#include <functional>
6#include <iostream>
7#include <memory>
8#include <vector>
9
10#include "CallableFunction.hpp"
11#include "FunctionContainer.hpp"
12#include "Logger.hpp"
13
14namespace Engine {
15class Core;
16
18
20
25 public:
32 template <typename... TSystem> inline decltype(auto) AddSystems(TSystem... systems)
33 {
34 return AddFunctions(systems...);
35 }
36
40 inline decltype(auto) GetSystems() { return GetFunctions(); }
41
47 inline decltype(auto) DeleteSystem(const FunctionUtils::FunctionID &id) { return DeleteFunction(id); }
48
49 private:
54 template <typename TCallable> void AddSystem(TCallable callable) { AddFunction(callable); }
55};
56
57} // namespace Engine
The core is the place where all the data of the engine is stored. It contains the registry (entities)...
Definition Core.hpp:33
Container class for managing multiple systems.
Definition System.hpp:24
void AddSystem(TCallable callable)
Add a system to the container.
Definition System.hpp:54
decltype(auto) AddSystems(TSystem... systems)
Adds systems to the container.
Definition System.hpp:32
decltype(auto) GetSystems()
Gets the list of systems in the container.
Definition System.hpp:40
decltype(auto) DeleteSystem(const FunctionUtils::FunctionID &id)
Deletes a system from the container by its FunctionID.
Definition System.hpp:47
Base class for all functions contained in a FunctionContainer.
Definition BaseFunction.hpp:10
Abstract class that holds a callable object, to be later stored in a container.
Definition CallableFunction.hpp:13
Container for functions, allowing for dynamic storage and invocation.
Definition FunctionContainer.hpp:14
const std::list< std::unique_ptr< FunctionType > > & GetFunctions()
Definition FunctionContainer.hpp:87
FunctionUtils::FunctionID AddFunction(TCallable callable)
Definition FunctionContainer.inl:7
decltype(auto) AddFunctions(TFunctions... functions)
Definition FunctionContainer.hpp:77
std::unique_ptr< FunctionType > DeleteFunction(FunctionID id)
Definition FunctionContainer.inl:60
Definition Core.hpp:17
FunctionUtils::BaseFunction< void, Core & > SystemBase
Definition System.hpp:17
FunctionUtils::CallableFunction< TCallable, void, Core & > System
Definition System.hpp:19
std::size_t FunctionID
FunctionID class to represent a unique identifier for functions.
Definition FunctionID.hpp:9