GPR5100 - Rollback
Loading...
Searching...
No Matches
Public Member Functions | List of all members
core::EntityManager Class Reference

Manages the entities in an array using bitwise operations to know if it has components. More...

#include <entity.h>

Public Member Functions

 EntityManager (std::size_t reservedSize)
 
Entity CreateEntity ()
 CreateEntity is a method that will return the next available Entity index. It will look at the internal entityMasks_ array and give the first one that is free to use. If none are free, the array is reallocated. More...
 
void DestroyEntity (Entity entity)
 DestroyEntity is a method that will erase all Component from the EntityMask. It means that EntityExists will be false and that HasComponent will always return false. It will not do anything to the actual ComponentManager. More...
 
void AddComponent (Entity entity, EntityMask mask)
 AddComponent is a method that adds the bitwise entity mask to the entity mask. It is normally called by the ComponentManager. More...
 
void RemoveComponent (Entity entity, EntityMask mask)
 RemoveComponent is a method that removes the bitwise entity mask to the entity mask. More...
 
bool HasComponent (Entity entity, EntityMask mask) const
 HasComponent is a method that check if a certain Entity has a EntityMask on. More...
 
bool EntityExists (Entity entity) const
 EntityExists is a method that check if a certain Entity has any Component and thus do exist. More...
 
std::size_t GetEntitiesSize () const
 GetEntitiesSize is a method that returns the size of the EntityMask array. More...
 

Detailed Description

Manages the entities in an array using bitwise operations to know if it has components.

Member Function Documentation

◆ AddComponent()

void core::EntityManager::AddComponent ( Entity  entity,
EntityMask  mask 
)

AddComponent is a method that adds the bitwise entity mask to the entity mask. It is normally called by the ComponentManager.

Parameters
entityis the entity to add the new EntityMask
maskis the Component bitwise mask to be added to the Entity
Here is the caller graph for this function:

◆ CreateEntity()

Entity core::EntityManager::CreateEntity ( )

CreateEntity is a method that will return the next available Entity index. It will look at the internal entityMasks_ array and give the first one that is free to use. If none are free, the array is reallocated.

Returns
the newly created Entity
Here is the call graph for this function:

◆ DestroyEntity()

void core::EntityManager::DestroyEntity ( Entity  entity)

DestroyEntity is a method that will erase all Component from the EntityMask. It means that EntityExists will be false and that HasComponent will always return false. It will not do anything to the actual ComponentManager.

Parameters
entityis the mask that will be voided

◆ EntityExists()

bool core::EntityManager::EntityExists ( Entity  entity) const

EntityExists is a method that check if a certain Entity has any Component and thus do exist.

Parameters
entityis the Entity that we check
Returns
the statement result if an Entity exists

◆ GetEntitiesSize()

std::size_t core::EntityManager::GetEntitiesSize ( ) const

GetEntitiesSize is a method that returns the size of the EntityMask array.

Returns
the total size of the EntityMask array.

◆ HasComponent()

bool core::EntityManager::HasComponent ( Entity  entity,
EntityMask  mask 
) const

HasComponent is a method that check if a certain Entity has a EntityMask on.

Parameters
entityis the Entity that we check
maskis the Component bitwise mask to check.
Returns
the statement result if an Entity has a certain bitwise mask on.

◆ RemoveComponent()

void core::EntityManager::RemoveComponent ( Entity  entity,
EntityMask  mask 
)

RemoveComponent is a method that removes the bitwise entity mask to the entity mask.

Parameters
entityis the entity to remove the EntityMask
maskis the Component bitwise mask to be removed to the Entity

The documentation for this class was generated from the following files: