44 const std::string
getId()
const;
47 const std::string _id;
77 void add(
const std::shared_ptr<Component> &component);
94 std::shared_ptr<Component>
getComponent(
const std::string
id)
const;
98 std::map<std::string, std::shared_ptr<Component>> _components;
A component of an entity in the game's component entity system.
Definition: Entity.hpp:27
virtual ~Component()
This is only declared to make the class polymorphic so that dymaic_cast between Component types works...
const std::string getId() const
Get the ID of the component. This will return the same value for all instances of a class of Componen...
Component(const std::string id)
Construct a new Component object.
An entity in the game's component entity system.
Definition: Entity.hpp:14
int getId() const
Get the ID of the Entity.
bool hasComponent(const std::string id) const
Check if the Entity has a component of the specified type.
std::shared_ptr< Component > getComponent(const std::string id) const
Get the Component object.
void add(const std::shared_ptr< Component > &component)
Adds the provided component to the entity.
Entity()
Construct a new Entity with a random ID.
Entity(int id)
Construct a new Entity object with a specific ID.