vecs
Fast, flexible ecs in C++ with ergonomic API
Loading...
Searching...
No Matches
vecs::EntityBuilder Class Reference

Provides methods to construct and modify entities within the ECS world. More...

#include <vecs.h>

Public Member Functions

 EntityBuilder ()=delete
 Deleted default constructor to prevent creating an EntityBuilder without parameters.
 
template<typename... Components>
bool has () const
 Checks if the entity has all specified components.
 
 operator Entity ()
 Implicit conversion to Entity type.
 
void despawn ()
 
template<typename... Components>
EntityBuilderinsert (Components &&... components)
 Inserts components into the entity.
 
template<typename Component >
EntityBuilderremove ()
 
template<typename Func >
EntityBuilderwith_children (Func &&func)
 Spawns a new entity, allows modifications via a function, and assigns it as a child of the current entity.
 
EntityBuilderadd_child (Entity entity)
 Adds an existing entity as a child of the current entity.
 
template<typename... Components>
EntityBuilderinsert_child (Components &&... components)
 Spawns a new entity, inserts components, and assigns it as a child of the current entity.
 

Friends

class World
 
class EntityCommands
 

Detailed Description

Provides methods to construct and modify entities within the ECS world.

Member Function Documentation

◆ add_child()

EntityBuilder & vecs::EntityBuilder::add_child ( Entity entity)
inline

Adds an existing entity as a child of the current entity.

Parameters
entityThe entity to be added as a child.
Returns
Reference to the EntityBuilder for chaining operations.

◆ has()

template<typename... Components>
bool vecs::EntityBuilder::has ( ) const
inline

Checks if the entity has all specified components.

Template Parameters
ComponentsThe types of components to check for.
Returns
True if the entity has all the specified components, otherwise false.

◆ insert()

template<typename... Components>
EntityBuilder & vecs::EntityBuilder::insert ( Components &&... components)
inline

Inserts components into the entity.

Template Parameters
ComponentsThe types of components to insert.
Parameters
componentsComponents to insert into the entity.
Returns
Reference to the EntityBuilder for chaining operations.

◆ insert_child()

template<typename... Components>
EntityBuilder & vecs::EntityBuilder::insert_child ( Components &&... components)
inline

Spawns a new entity, inserts components, and assigns it as a child of the current entity.

Template Parameters
ComponentsThe types of components to insert into the new entity.
Parameters
componentsComponents to insert into the new entity.
Returns
Reference to the EntityBuilder for chaining operations.

◆ operator Entity()

vecs::EntityBuilder::operator Entity ( )
inline

Implicit conversion to Entity type.

Returns
The entity ID associated with this EntityBuilder.

◆ with_children()

template<typename Func >
EntityBuilder & vecs::EntityBuilder::with_children ( Func && func)
inline

Spawns a new entity, allows modifications via a function, and assigns it as a child of the current entity.

Template Parameters
FuncThe type of the function that modifies the child entity.
Parameters
funcFunction that takes an EntityBuilder for modifying the child entity.
Returns
Reference to the EntityBuilder for chaining operations.

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