ecs
Entity-Component-System
Loading...
Searching...
No Matches
Entity_impl.hpp
Go to the documentation of this file.
1
11#ifndef ENTITY_IMPL_HPP
12#define ENTITY_IMPL_HPP
13
14//local
15#include "Entity.hpp"
16#include "Registry.hpp"
17
18//global
19#include <cstddef>
20
21namespace ecs {
22
23 class Registry;
24 using RegistryRef = Registry &;
25
26 template <typename ... Component, typename>
28 (_ecs.addComponent<Component>(*this, std::forward<Component>(c)), ...);
29 }
30
31 template <typename ... Component, typename>
33 (_ecs.removeComponent<Component>(*this), ...);
34 }
35}
36
39#endif // ENTITY_IMPL_HPP
Component is a template define in Registry. (not a class)
void addComponent(Component &&... c)
add a component to the entity using the registryRef method addComponent
Definition Entity_impl.hpp:27
void removeComponent()
remove a component from the entity using the registryRef method removeComponent
Definition Entity_impl.hpp:32
void addComponent(Entity const &to, Component &&...c)
Definition Registry_impl.hpp:53
void removeComponent(Entity const &from)
remove a component from the given entity
Definition Registry_impl.hpp:64
Entity Component System.
Registry & RegistryRef
Definition Entity.hpp:23