Euphoria
|
ecs.h
Go to the documentation of this file.
144 ComponentIndex set_component_array(const std::string& name, std::unique_ptr<ComponentArrayBase>&& components);
184 [[nodiscard]] std::vector<EntityHandle> view(const std::vector<ComponentIndex>& matching_components) const;
194 ASSERTX(base->name == get_component_base_name<T>(), base->name, get_component_base_name<T>(), get_component_name(comp_ind));
Definition: ecs.cc:11
constexpr std::string_view get_component_base_name()
Definition: ecs.h:21
Definition: ecs.h:27
ComponentArrayBase & operator=(ComponentArrayBase &&)=delete
virtual ~ComponentArrayBase()=default
ComponentArrayBase(const ComponentArrayBase &)=delete
virtual void remove(EntityHandle)=0
ComponentArrayBase(ComponentArrayBase &&)=delete
virtual bool has(EntityHandle) const =0
ComponentArrayBase(std::string_view n)
Definition: ecs.cc:18
ComponentArrayBase & operator=(const ComponentArrayBase &)=delete
Definition: ecs.h:46
GenericComponentArray()
Definition: ecs.h:50
std::vector< std::optional< T > > components
Definition: ecs.h:48
void add(EntityHandle entity, T &&component)
Definition: ecs.h:56
void remove(EntityHandle entity) override
Definition: ecs.h:104
bool has_value_for_index(std::size_t index) const
Definition: ecs.h:93
bool has(EntityHandle entity) const override
Definition: ecs.h:118
T * get_or_null(EntityHandle entity)
Definition: ecs.h:77
Definition: ecs.h:133
bool has_component(EntityHandle entity, ComponentIndex comp_ind) const
Definition: ecs.cc:258
ComponentIndex register_component(const std::string &name)
Definition: ecs.h:148
ComponentIndex set_component_array(const std::string &name, std::unique_ptr< ComponentArrayBase > &&components)
Definition: ecs.cc:263
Registry & operator=(const Registry &)=delete
void add_component(EntityHandle entity, ComponentIndex comp_ind, T &&component)
Definition: ecs.h:155
void remove_component(EntityHandle entity, ComponentIndex comp_ind)
Definition: ecs.h:163
T * get_component_or_null(EntityHandle entity, ComponentIndex comp_ind)
Definition: ecs.h:177
Registry(const Registry &)=delete
int get_number_of_active_entities() const
Definition: ecs.cc:236
std::vector< EntityHandle > view(const std::vector< ComponentIndex > &matching_components) const
Definition: ecs.cc:279
Registry & operator=(Registry &&)=delete
Registry(Registry &&)=delete
std::string get_component_debug_name(ComponentIndex c) const
Definition: ecs.cc:247
T & get_component(EntityHandle entity, ComponentIndex comp_ind)
Definition: ecs.h:171