ECSTASY
All in the name
Loading...
Searching...
No Matches
ISystem.hpp
Go to the documentation of this file.
1
11
12#ifndef ECSTASY_SYSTEM_ISYSTEM_HPP_
13#define ECSTASY_SYSTEM_ISYSTEM_HPP_
14
16
17namespace ecstasy
18{
20 class Registry;
21
28 class ISystem {
29 public:
31 virtual ~ISystem() = default;
32
41 virtual void run(Registry &registry) = 0;
42
54 [[nodiscard]] constexpr Timer &getTimer() noexcept
55 {
56 return _timer;
57 }
58
70 [[nodiscard]] constexpr const Timer &getTimer() const noexcept
71 {
72 return _timer;
73 }
74
81 [[nodiscard]] constexpr bool enabled() const noexcept
82 {
83 return !_disabled;
84 }
85
92 constexpr void disable() noexcept
93 {
94 _disabled = true;
95 }
96
103 constexpr void enable() noexcept
104 {
105 _disabled = false;
106 }
107
108 private:
112 bool _disabled = false;
113 };
114} // namespace ecstasy
115
116#endif /* !ECSTASY_SYSTEM_ISYSTEM_HPP_ */
System interface, base class of all systems.
Definition ISystem.hpp:28
constexpr Timer & getTimer() noexcept
Get the system timer.
Definition ISystem.hpp:54
virtual ~ISystem()=default
Default destructor.
bool _disabled
Whether the timer is disabled.
Definition ISystem.hpp:112
constexpr void disable() noexcept
Disable the system.
Definition ISystem.hpp:92
constexpr const Timer & getTimer() const noexcept
Get the system timer.
Definition ISystem.hpp:70
constexpr bool enabled() const noexcept
Whether the system is enabled.
Definition ISystem.hpp:81
constexpr void enable() noexcept
Enable the system.
Definition ISystem.hpp:103
virtual void run(Registry &registry)=0
Run the system.
Timer _timer
Timer to control the execution of the system.
Definition ISystem.hpp:110
Base of an ECS architecture.
Definition Registry.hpp:82
Timer class to control the execution of systems.
Definition Timer.hpp:32
Namespace containing all symbols specific to ecstasy.
Definition ecstasy.hpp:30