Minor - Start the Doxygen doc - V12.8.0

This commit is contained in:
2025-07-28 15:26:10 +02:00
parent 2c005592f0
commit 9431552316
445 changed files with 100476 additions and 72 deletions

View File

@@ -7,27 +7,44 @@
#include <cassert>
namespace ecs {
// Identifiant unique pour les entit<EFBFBD>s
using EntityID = uint32_t;
/**
* Type alias for a unique identifier for an entity.
*/
using EntityID = uint32_t;
class Entity {
public:
/**
* Builder for an Entity with a unique ID.
*/
explicit Entity(EntityID id) : m_ID(id) {}
~Entity() = default;
// Emp<6D>cher la copie
/**
* No copy constructor or assignment operator to prevent copying.
*/
Entity(const Entity&) = delete;
Entity& operator=(const Entity&) = delete;
// Permettre le d<>placement
/**
* Move constructor and assignment operator to allow moving entities.
*/
Entity(Entity&&) = default;
Entity& operator=(Entity&&) = default;
// Getter pour l'ID
/**
* Get the unique identifier for the entity.
* @return The unique ID of the entity.
*/
EntityID GetID() const { return m_ID; }
// Ajouter un composant
/**
* Add a component of type T to the entity.
* If the component already exists, it returns the existing component.
* @tparam T
* @param args Arguments to construct the component.
* @return A shared pointer to the added or existing component.
*/
template<typename T, typename... Args>
std::shared_ptr<T> AddComponent(Args&&... args) {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
@@ -49,7 +66,11 @@ public:
return component;
}
// R<>cup<75>rer un composant
/**
* Get a component of type T from the entity.
* @tparam T
* @return A shared pointer to the component if it exists, nullptr otherwise.
*/
template<typename T>
std::shared_ptr<T> GetComponent() {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
@@ -64,7 +85,11 @@ public:
return nullptr;
}
// V<>rifier si l'entit<69> poss<73>de un composant
/**
* Check if the entity has a component of type T.
* @tparam T
* @return true if the entity has the component, false otherwise.
*/
template<typename T>
bool HasComponent() const {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
@@ -73,7 +98,10 @@ public:
return m_Components.find(typeID) != m_Components.end();
}
// Supprimer un composant
/**
* Remove a component of type T from the entity.
* @tparam T
*/
template<typename T>
void RemoveComponent() {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
@@ -86,7 +114,10 @@ public:
}
}
// Mettre <20> jour tous les composants
/**
* Update all components of the entity.
* @param deltaTime
*/
void UpdateComponents(float deltaTime) {
for (auto& [typeID, component] : m_Components) {
component->Update(deltaTime);
@@ -94,7 +125,15 @@ public:
}
private:
/**
* Unique identifier for the entity.
*/
EntityID m_ID;
/**
* Map to hold components associated with the entity.
* The key is the type ID of the component, and the value is a shared pointer to the component.
*/
std::unordered_map<ComponentTypeID, ComponentPtr> m_Components;
};