ECSM v0.3.0
Entityfinal

An object containing components. More...

#include <ecsm.hpp>

Classes

struct  ComponentData
 Entity component data container. More...
 

Public Member Functions

bool destroy ()
 Destroys all entity components.
 
const ComponentDatagetComponents () const noexcept
 Returns entity components array.
 
uint32_t getComponentCount () const noexcept
 Returns entity components array size.
 
uint32_t getComponentCapacity () const noexcept
 Returns entity components array capacity.
 
bool hasComponents () const noexcept
 Returns true if entity has components.
 
const ComponentDatafindComponent (size_t type) const noexcept
 Searches for the specified component type.
 

Friends

class Manager
 

Detailed Description

An object containing components.

The entity is a general-purpose object. It doesn't have any inherent behavior or data by itself. Instead, it serves as a container for components.


Class Documentation

◆ ecsm::Entity::ComponentData

struct ecsm::Entity::ComponentData

Entity component data container.

Class Members
size_t type = 0
System * system = nullptr
ID< Component > instance = {}

Member Function Documentation

◆ destroy()

bool destroy ( )

Destroys all entity components.

Note
Components are not destroyed immediately, only after the dispose call.

◆ getComponents()

const ComponentData * getComponents ( ) const
inlinenoexcept

Returns entity components array.

Use Manager to add or remove components.

◆ getComponentCount()

uint32_t getComponentCount ( ) const
inlinenoexcept

Returns entity components array size.

Use Manager to add or remove components.

◆ getComponentCapacity()

uint32_t getComponentCapacity ( ) const
inlinenoexcept

Returns entity components array capacity.

Use Manager to add or remove components.

◆ findComponent()

const ComponentData * findComponent ( size_t type) const
inlinenoexcept

Searches for the specified component type.

Parameters
typetarget component type hash code
Returns
Component data on success, otherwise null.