FECS
Loading...
Searching...
No Matches
types.h File Reference

Defines core types and constants for the FECS ECS system. More...

#include <cstdint>
#include <limits>

Go to the source code of this file.

Classes

struct  FECS::GlobalComponent
 Dummy tag component used for tracking global ECS changes (e.g. full view rebuilds). More...
 

Macros

#define FECS_SPARSE_PAGE_SIZE   2048
 Defines the default number of elements per sparse page, if not specified.
 

Typedefs

using FECS::Entity = std::uint32_t
 Type alias for entity IDs (32-bit unsigned integer)
 
using FECS::ComponentIndex = std::uint32_t
 Type alias for identifying component type indices.
 

Functions

Entity FECS::BuildEntityIndex (std::uint32_t index, std::uint32_t version)
 Combines an entity index and version into a single 32-bit entity ID.
 
std::uint32_t FECS::GetEntityIndex (Entity e)
 Extracts the index portion from an entity ID.
 
std::uint32_t FECS::GetEntityVersion (Entity e)
 Extracts the verison portion from an entity ID.
 

Detailed Description

Defines core types and constants for the FECS ECS system.

Includes definitions for entities, component indexing, sparse page sizing, and utility functions for encoding and decoding entity IDs.

Function Documentation

◆ BuildEntityIndex()

Entity FECS::BuildEntityIndex ( std::uint32_t index,
std::uint32_t version )
inline

Combines an entity index and version into a single 32-bit entity ID.

The lower 20 bits are used for the index, and the upper 12 for the version.

Parameters
indexThe entity index.
versionThe entity verison.
Returns
A composed 32-bit entity ID.

◆ GetEntityIndex()

std::uint32_t FECS::GetEntityIndex ( Entity e)
inline

Extracts the index portion from an entity ID.

Parameters
eThe encoded entity ID.
Returns
The raw entity index.

◆ GetEntityVersion()

std::uint32_t FECS::GetEntityVersion ( Entity e)
inline

Extracts the verison portion from an entity ID.

Parameters
eThe encoded entity ID.
Returns
The version component of the entity.