Minor - Start the Doxygen doc - V12.8.0
This commit is contained in:
@@ -3,36 +3,74 @@
|
||||
#include <string>
|
||||
|
||||
namespace ecs {
|
||||
|
||||
enum class ObjectType
|
||||
{
|
||||
Sphere,
|
||||
Cube,
|
||||
Terrain,
|
||||
Unknown
|
||||
};
|
||||
/**
|
||||
* Enum for different types of objects in the ECS.
|
||||
* The object types is used to specify the collision type of the object.
|
||||
*/
|
||||
enum class ObjectType
|
||||
{
|
||||
Sphere,
|
||||
Cube,
|
||||
Terrain,
|
||||
Unknown
|
||||
};
|
||||
|
||||
class IdentityComponent : public Component {
|
||||
public:
|
||||
/**
|
||||
* Builder for the IdentityComponent class.
|
||||
*/
|
||||
IdentityComponent() : m_id(0), m_type(ObjectType::Unknown) {}
|
||||
explicit IdentityComponent(int id) : m_id(id), m_type(ObjectType::Unknown) {}
|
||||
IdentityComponent(int id, const std::string& name) : m_id(id), m_name(name), m_type(ObjectType::Unknown) {}
|
||||
~IdentityComponent() = default;
|
||||
|
||||
/**
|
||||
* Initialize the component.
|
||||
* This method is called when the component is added to an entity.
|
||||
* It can be used to set up initial values or perform any necessary setup.
|
||||
*/
|
||||
void Initialize() override {}
|
||||
//void Update(float deltaTime) override {}
|
||||
|
||||
// Getters et setters
|
||||
|
||||
/**
|
||||
* Get the ID stored by the component.
|
||||
* @return The ID as an int.
|
||||
*/
|
||||
int GetId() const { return m_id; }
|
||||
/**
|
||||
* Set the ID for the component.
|
||||
* @param id The ID to set.
|
||||
*/
|
||||
void SetId(int id) { m_id = id; }
|
||||
|
||||
/**
|
||||
* Get the name of the object.
|
||||
* @return The name as a string.
|
||||
*/
|
||||
const std::string& GetName() const { return m_name; }
|
||||
/**
|
||||
* Set the name of the object.
|
||||
* @param name The name to set.
|
||||
*/
|
||||
void SetName(const std::string& name) { m_name = name; }
|
||||
|
||||
/**
|
||||
* Get the type of the object.
|
||||
* @return The type as an ObjectType enum.
|
||||
*/
|
||||
ObjectType GetType() const { return m_type; }
|
||||
/**
|
||||
* Set the type of the object.
|
||||
* @param type The type to set as an ObjectType enum.
|
||||
*/
|
||||
void SetType(ObjectType type) { m_type = type; }
|
||||
|
||||
// Conversions utiles
|
||||
/**
|
||||
* Convert an ObjectType to a string representation.
|
||||
* @param type The ObjectType to convert.
|
||||
* @return A string representation of the ObjectType.
|
||||
*/
|
||||
static std::string ObjectTypeToString(ObjectType type) {
|
||||
switch (type) {
|
||||
case ObjectType::Cube: return "Cube";
|
||||
@@ -42,6 +80,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string representation to an ObjectType.
|
||||
* @param str The string to convert.
|
||||
* @return The corresponding ObjectType, or Unknown if the string does not match any type.
|
||||
*/
|
||||
static ObjectType StringToObjectType(const std::string& str) {
|
||||
if (str == "Cube") return ObjectType::Cube;
|
||||
if (str == "Sphere") return ObjectType::Sphere;
|
||||
@@ -50,9 +93,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
int m_id;
|
||||
std::string m_name;
|
||||
ObjectType m_type;
|
||||
int m_id; // ID unique de l'objet
|
||||
std::string m_name; // Nom de l'objet
|
||||
ObjectType m_type; // Type de l'objet (Cube, Sphere, Terrain, etc.)
|
||||
};
|
||||
|
||||
} // namespace ecs
|
||||
|
Reference in New Issue
Block a user