Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
Loading...
Searching...
No Matches
Entity.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <cstdint>
3
#include <bitset>
4
#include <limits>
5
#include <functional>
6
11
class
Entity
{
12
public
:
14
using
IdType
= std::uint32_t;
16
static
constexpr
IdType
INVALID_ENTITY
= std::numeric_limits<IdType>::max();
17
21
Entity
() :
id
(
INVALID_ENTITY
) {}
26
explicit
Entity
(
IdType
i) :
id
(i) {}
27
32
IdType
getId
()
const
{
return
id
; }
33
39
bool
operator==
(
const
Entity
& other)
const
{
return
id
== other.
id
; }
45
bool
operator!=
(
const
Entity
& other)
const
{
return
id
!= other.
id
; }
46
47
private
:
49
IdType
id
;
50
};
51
53
constexpr
std::size_t
MAX_COMPONENTS
= 64;
55
using
ComponentMask
= std::bitset<MAX_COMPONENTS>;
MAX_COMPONENTS
constexpr std::size_t MAX_COMPONENTS
Maximum number of supported component types in the ECS.
Definition
Entity.hpp:53
ComponentMask
std::bitset< MAX_COMPONENTS > ComponentMask
Bitmask representing component registration status.
Definition
Entity.hpp:55
Entity::id
IdType id
Unique numeric identifier.
Definition
Entity.hpp:49
Entity::INVALID_ENTITY
static constexpr IdType INVALID_ENTITY
Constant representing a null or invalid entity.
Definition
Entity.hpp:16
Entity::getId
IdType getId() const
Retrieve the raw identifier of the entity.
Definition
Entity.hpp:32
Entity::Entity
Entity(IdType i)
Construct a new Entity object with a given ID.
Definition
Entity.hpp:26
Entity::Entity
Entity()
Construct a new, invalid Entity object.
Definition
Entity.hpp:21
Entity::IdType
std::uint32_t IdType
Numeric type of the entity identifier.
Definition
Entity.hpp:14
Entity::operator==
bool operator==(const Entity &other) const
Check equality with another entity.
Definition
Entity.hpp:39
Entity::operator!=
bool operator!=(const Entity &other) const
Check inequality with another entity.
Definition
Entity.hpp:45
engine
include
ecs
Entity.hpp
Generated by
1.17.0