51 template<
CComponent C,
typename... Args>
inline C&
add(Args&&... args)
noexcept(std::is_nothrow_constructible_v<
C, Args...>) {
69 inline C&
addWith(
Block&&
block, Args&&... args)
noexcept(std::is_nothrow_constructible_v<
C, Args...>);
77 template<
CComponent C,
typename... Args>
inline C&
set(Args&&... args)
noexcept(std::is_nothrow_constructible_v<
C, Args...>);
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
A type that describes and provides type-erased operations on a component.
Definition Component.hpp:456
Definition EntityTemplate.hpp:21
virtual Any getComponent() noexcept=0
virtual const ComponentType & getComponentType() const noexcept=0
Definition EntityTemplate.hpp:28
C component
Definition EntityTemplate.hpp:30
TComponentData(Args &&... args)
Definition EntityTemplate.hpp:33
Any getComponent() const noexcept final
Definition EntityTemplate.hpp:43
const ComponentType & getComponentType() const noexcept final
Definition EntityTemplate.hpp:37
Any getComponent() noexcept final
Definition EntityTemplate.hpp:40
Definition EntityTemplate.hpp:19
C & getOr() noexcept(std::is_nothrow_constructible_v< C >)
Gets a component of type C.
Definition EntityTemplate.hpp:142
bool has() const noexcept
Checks if the entity has all components of types Cs.
FlatMap< ComponentID, UPtr< ComponentData > > mComponents
Definition EntityTemplate.hpp:46
Tuple< C0 &, C1 &, Cs &... > getOr() noexcept
Gets a set of components of types C0, C1 and Cs.
C & addWith(Block &&block, Args &&... args) noexcept(std::is_nothrow_constructible_v< C, Args... >)
Adds a new component and calls block with the added component.
bool empty() noexcept
Checks if the entity is empty (i.e.
Tuple< const C0 &, const C1 &, const Cs &... > get() const noexcept
Gets a set of components of types C0, C1 and Cs.
Definition EntityTemplate.hpp:134
void remove() noexcept(std::is_nothrow_destructible_v< C >)
Removes a component of type C from the entity.
Definition EntityTemplate.hpp:81
void clear()
Removes all components attached to the entity, without destroying the entity itself.
String mName
Definition EntityTemplate.hpp:47
const C & get() const noexcept
Gets a component of type C.
Definition EntityTemplate.hpp:108
C & set(Args &&... args) noexcept(std::is_nothrow_constructible_v< C, Args... >)
Sets a component.
C & get() noexcept
Gets a component of type C.
Definition EntityTemplate.hpp:94
Tuple< C0 &, C1 &, Cs &... > get() noexcept
Gets a set of components of types C0, C1 and Cs.
Definition EntityTemplate.hpp:124
C & add(Args &&... args) noexcept(std::is_nothrow_constructible_v< C, Args... >)
Adds a new component of the given type.
Definition EntityTemplate.hpp:51
C * getIf() noexcept
Gets a component of type C.
FlatMap is an almsot drop-in replacement of Map.
Definition FlatMap.hpp:53
Tuple is a fixed-size collection of heterogeneous values.
Definition Tuple.hpp:15
Definition Component.hpp:117
Definition Application.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
decltype(&*std::declval< I >() found)(const I &it, C &container)
Returns a pointer to the value if found, otherwise nullptr.
Definition Iterator.hpp:572