System¶
-
namespace
tnt
-
namespace
doo
Variables
-
template<typename T> concept system = requires { typename T::component; } and requires (T &t, object const& o, nlohmann::json& j, typename T::component const& c) { { t.add_object(o, c) } -> detail::void_type; { t.remove(o) } -> detail::void_type; { t.clear() } -> detail::void_type; { t.Update(o, 1.f) } -> detail::void_type; { t.from_json(o, j) } -> detail::void_type; { t.to_json(o, j) } -> detail::void_type; { t.active } -> std::same_as<tnt::sparse_set<tnt::doo::object>>; }
A concept representing the minimal requirements that a type must fulfill to be a DOO ECS system.
-
template<system
T
>
structsystem_base
: public tnt::crtp<T>¶ - #include <System.hpp>
A helper class for defining custom DOO ECS systems.
- Template Parameters
T
: The class that will be used as a system.
Public Functions
-
void
add_object
(object const &id, component const &c)¶ Add the data of the object with given id to the system.
- Parameters
id
: The id of the object.c
: The component data.
-
void
Update
(object const &id, float time_)¶ Update the data of the desired object.
- Parameters
id
: The id of the object.time_
: The time elapsed since the last Update call.
-
void
remove
(object const &id)¶ Remove the data of the desired object from the system.
- Parameters
id
: The id of the object to remove.
-
void clear () noexcept(noexcept(super.clear()))
Remove the data of all the objects from the system.
-
namespace
detail
¶ Variables
-
template<typename T> concept void_type = std::is_void_v<T>
-
-
-
namespace