Brenta Engine 1.2
Loading...
Searching...
No Matches
ecs.hpp
1// SPDX-License-Identifier: MIT
2// Author: Giovanni Santini
3// Mail: giovanni.santini@proton.me
4// Github: @San7o
5
6#pragma once
7
8#ifndef BRENTA_NO_ECS
9
10#include <brenta/subsystem.hpp>
11#include <viotecs/viotecs.hpp>
12
13namespace brenta
14{
15
16//
17// Ecs
18// ---
19//
20// The engine uses `viotecs` to handle all the ecs logic. This
21// subsystems is just a way to initialize the ECS.
22//
23class Ecs : public Subsystem
24{
25public:
26
27 class Builder;
28
29 // Subsystem interface
30 static const std::string subsystem_name;
31 std::string name() override;
32 bool is_initialized() override;
33 std::expected<void, Subsystem::Error> initialize() override;
34 std::expected<void, Subsystem::Error> terminate() override;
35
36 // Member functions
37
38 static Ecs &instance();
39
40private:
41
42 static bool initialized;
43
44 // Private constructors / destructors for singleton
45 Ecs() = default;
46 ~Ecs() = default;
47
48};
49
51{
52public:
53
54 Builder() = default;
55 ~Builder() = default;
56
57 Subsystem &build();
58};
59
60} // namespace brenta
61
62#endif // BRENTA_NO_ECS