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

Provides a deferred command interface to manage entity operations within the ECS world. More...

#include <vecs.h>

Public Member Functions

 Commands (World &world)
 
 Commands (const Commands &)=delete
 
Commandsoperator= (const Commands &)=delete
 
 Commands (Commands &&) noexcept=default
 
Commandsoperator= (Commands &&) noexcept=delete
 
template<typename Func >
void add (Func &&func)
 Adds a deferred command to be executed on the world.
 
EntityCommands spawn ()
 Spawns a new entity and provides a deferred interface to add components to it.
 
EntityCommands entity (Entity entity)
 Provides an EntityCommands interface to manage commands for an existing entity.
 

Friends

class World
 

Detailed Description

Provides a deferred command interface to manage entity operations within the ECS world.

The Commands class allows spawning entities, adding entity-specific commands, and scheduling deferred world operations to be executed later.

Member Function Documentation

◆ add()

template<typename Func >
void vecs::Commands::add ( Func && func)
inline

Adds a deferred command to be executed on the world.

Parameters
funcThe function representing a world-level operation to defer.

◆ entity()

EntityCommands vecs::Commands::entity ( Entity entity)
inline

Provides an EntityCommands interface to manage commands for an existing entity.

This method retrieves an existing entity and queues commands to modify its state, returning an EntityCommands instance to add specific deferred commands for that entity.

Parameters
entityThe entity to be managed by deferred commands.
Returns
An EntityCommands instance for the specified entity.

◆ spawn()

EntityCommands vecs::Commands::spawn ( )
inline

Spawns a new entity and provides a deferred interface to add components to it.

This method creates a new entity in the ECS and returns an EntityCommands instance to allow deferred commands for that specific entity.

Returns
An EntityCommands instance for managing deferred commands on the newly spawned entity.

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