galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages Concepts
System.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_SYSTEMS_SYSTEM_HPP_
9#define GALAXY_SYSTEMS_SYSTEM_HPP_
10
11#include <concepts>
12#include <string>
13
14#include <entt/entity/registry.hpp>
15
16namespace galaxy
17{
18 namespace systems
19 {
23 class System
24 {
25 public:
29 virtual ~System() noexcept;
30
36 virtual void update(entt::registry& registry) = 0;
37
43 [[nodiscard]]
44 const std::string& id() const noexcept;
45
46 protected:
52 System(const std::string& id) noexcept;
53
54 private:
58 System() = delete;
59
60 protected:
64 std::string m_id;
65 };
66 } // namespace systems
67
68 namespace meta
69 {
75 template<typename Type>
76 concept is_system = std::derived_from<Type, systems::System>;
77 } // namespace meta
78} // namespace galaxy
79
80#endif
Represents a system that operates on sets of components.
Definition System.hpp:24
virtual void update(entt::registry &registry)=0
Abstract implementation for updating the system. Use the manager to retreive your components.
virtual ~System() noexcept
Destructor.
Definition System.cpp:19
const std::string & id() const noexcept
Get identifier.
Definition System.cpp:23
std::string m_id
Debug id.
Definition System.hpp:64
Concept to ensure a system is actually derived from a System.
Definition System.hpp:76
Timer.hpp galaxy.
Definition Async.hpp:17
STL namespace.