Minor - Start the Doxygen doc - V12.8.0
This commit is contained in:
@@ -8,10 +8,17 @@ namespace ecs {
|
||||
|
||||
class EntityManager {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Type pour l'ID d'une entit<69>
|
||||
*/
|
||||
EntityManager() : m_NextEntityID(0) {}
|
||||
~EntityManager() = default;
|
||||
|
||||
// Cr<43>er une nouvelle entit<69>
|
||||
/**
|
||||
* Create a new entity.
|
||||
* @return A shared pointer to the newly created entity.
|
||||
*/
|
||||
std::shared_ptr<Entity> CreateEntity() {
|
||||
EntityID id;
|
||||
|
||||
@@ -29,7 +36,10 @@ public:
|
||||
return entity;
|
||||
}
|
||||
|
||||
// Supprimer une entit<69>
|
||||
/**
|
||||
* Destroy an entity by its ID and recycle its ID for future use.
|
||||
* @param id The ID of the entity to destroy.
|
||||
*/
|
||||
void DestroyEntity(EntityID id) {
|
||||
auto it = m_Entities.find(id);
|
||||
if (it != m_Entities.end()) {
|
||||
@@ -38,7 +48,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Obtenir une entit<69> par son ID
|
||||
/**
|
||||
* Get an entity by its ID.
|
||||
* @param id The ID of the entity to retrieve.
|
||||
* @return A shared pointer to the entity, or nullptr if it does not exist.
|
||||
*/
|
||||
std::shared_ptr<Entity> GetEntity(EntityID id) {
|
||||
auto it = m_Entities.find(id);
|
||||
if (it != m_Entities.end()) {
|
||||
@@ -47,14 +61,20 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Mettre <20> jour toutes les entit<69>s
|
||||
/**
|
||||
* Update all entities by calling their UpdateComponents method.
|
||||
* @param deltaTime The time elapsed since the last update.
|
||||
*/
|
||||
void UpdateEntities(float deltaTime) {
|
||||
for (auto& [id, entity] : m_Entities) {
|
||||
entity->UpdateComponents(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
// Obtenir toutes les entit<69>s
|
||||
/**
|
||||
* Get all entities managed by the EntityManager.
|
||||
* @return A vector of shared pointers to all entities.
|
||||
*/
|
||||
std::vector<std::shared_ptr<Entity>> GetAllEntities() {
|
||||
std::vector<std::shared_ptr<Entity>> result;
|
||||
result.reserve(m_Entities.size());
|
||||
@@ -66,7 +86,11 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
// Obtenir toutes les entit<69>s qui ont un composant sp<73>cifique
|
||||
/**
|
||||
* Get all entities that have a specific component type.
|
||||
* @tparam T The component type to filter entities by.
|
||||
* @return A vector of shared pointers to entities that have the specified component.
|
||||
*/
|
||||
template<typename T>
|
||||
std::vector<std::shared_ptr<Entity>> GetEntitiesWithComponent() {
|
||||
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
|
||||
@@ -82,12 +106,18 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
// Obtenir le nombre d'entit<69>s
|
||||
/**
|
||||
* Get the total number of entities managed by the EntityManager.
|
||||
* @return The count of entities.
|
||||
*/
|
||||
size_t GetEntityCount() const {
|
||||
return m_Entities.size();
|
||||
}
|
||||
|
||||
// Vider toutes les entit<69>s
|
||||
/**
|
||||
* Clear all entities and reset the EntityManager.
|
||||
* This will remove all entities and free their IDs for future use.
|
||||
*/
|
||||
void Clear() {
|
||||
m_Entities.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user