Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
Entity Class Reference

Lightweight identifier representing a game object in the Entity Component System. More...

#include <Entity.hpp>

Public Types

using IdType = std::uint32_t
 Numeric type of the entity identifier.

Public Member Functions

 Entity ()
 Construct a new, invalid Entity object.
 Entity (IdType i)
 Construct a new Entity object with a given ID.
IdType getId () const
 Retrieve the raw identifier of the entity.
bool operator== (const Entity &other) const
 Check equality with another entity.
bool operator!= (const Entity &other) const
 Check inequality with another entity.

Static Public Attributes

static constexpr IdType INVALID_ENTITY = std::numeric_limits<IdType>::max()
 Constant representing a null or invalid entity.

Private Attributes

IdType id
 Unique numeric identifier.

Detailed Description

Lightweight identifier representing a game object in the Entity Component System.

Member Typedef Documentation

◆ IdType

using Entity::IdType = std::uint32_t

Numeric type of the entity identifier.

Constructor & Destructor Documentation

◆ Entity() [1/2]

Entity::Entity ( )
inline

Construct a new, invalid Entity object.

◆ Entity() [2/2]

Entity::Entity ( IdType i)
inlineexplicit

Construct a new Entity object with a given ID.

Parameters
iThe identifier for the entity.

Member Function Documentation

◆ getId()

IdType Entity::getId ( ) const
inline

Retrieve the raw identifier of the entity.

Returns
The raw ID.

◆ operator!=()

bool Entity::operator!= ( const Entity & other) const
inline

Check inequality with another entity.

Parameters
otherThe entity to compare with.
Returns
True if IDs differ, false otherwise.

◆ operator==()

bool Entity::operator== ( const Entity & other) const
inline

Check equality with another entity.

Parameters
otherThe entity to compare with.
Returns
True if IDs are identical, false otherwise.

Member Data Documentation

◆ id

IdType Entity::id
private

Unique numeric identifier.

◆ INVALID_ENTITY

IdType Entity::INVALID_ENTITY = std::numeric_limits<IdType>::max()
staticconstexpr

Constant representing a null or invalid entity.


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