|
R-Type
Distributed multiplayer game engine in C++
|
Builder pattern for creating entities with multiple components. More...
#include <EntityBuilder.hpp>

Public Member Functions | |
| EntityBuilder (ECSWorld *world) | |
| Construct an EntityBuilder. | |
| template<typename T > | |
| EntityBuilder & | with (const T &component) |
| Add a component to the entity being built. | |
| template<typename T > | |
| EntityBuilder & | with (std::function< T()> factory) |
| Add a component using a factory function. | |
| EntityBuilder & | configure (std::function< void(Entity &)> configurator) |
| Apply a configuration function to the entity. | |
| Entity | build () |
| Finalize and return the built entity. | |
| operator Entity () | |
| Implicit conversion to Entity. | |
Private Attributes | |
| ECSWorld * | _world |
| Entity | _entity |
Builder pattern for creating entities with multiple components.
Provides a fluent interface for constructing complex entities. Useful for creating game objects with multiple components in a clean way.
Definition at line 23 of file EntityBuilder.hpp.
|
explicit |
Construct an EntityBuilder.
| world | Pointer to the ECS world |
Definition at line 12 of file EntityBuilder.cpp.
| Entity ecs::wrapper::EntityBuilder::build | ( | ) |
Finalize and return the built entity.
Definition at line 19 of file EntityBuilder.cpp.
References _entity.
| EntityBuilder & ecs::wrapper::EntityBuilder::configure | ( | std::function< void(Entity &)> | configurator | ) |
Apply a configuration function to the entity.
| configurator | Function that configures the entity |
Definition at line 14 of file EntityBuilder.cpp.
References _entity.
| ecs::wrapper::EntityBuilder::operator Entity | ( | ) |
Implicit conversion to Entity.
Definition at line 23 of file EntityBuilder.cpp.
| EntityBuilder & ecs::wrapper::EntityBuilder::with | ( | const T & | component | ) |
Add a component to the entity being built.
| T | Component type |
| component | The component data |
| EntityBuilder & ecs::wrapper::EntityBuilder::with | ( | std::function< T()> | factory | ) |
Add a component using a factory function.
| T | Component type |
| factory | Function that creates the component |
|
private |
Definition at line 28 of file EntityBuilder.hpp.
Referenced by build(), and configure().
|
private |
Definition at line 27 of file EntityBuilder.hpp.