vecs
Fast, flexible ecs in C++ with ergonomic API
|
Observer class for tracking component changes within a system. More...
#include <vecs.h>
Public Member Functions | |
Observer () | |
Constructs an Observer for the specified components. | |
Observer (const Observer &)=delete | |
Observer & | operator= (const Observer &)=delete |
Observer (Observer &&)=delete | |
Observer & | operator= (Observer &&)=delete |
const std::vector< Entity > & | added () const override |
Retrieves the entities that have been added for the first time with the observed components. | |
const std::vector< Entity > & | inserted () const override |
Retrieves the entities that have been inserted with the observed components. | |
const std::vector< Entity > & | removed () const override |
Retrieves the entities that have been had the observed components removed. | |
Public Member Functions inherited from vecs::TypeErasedObserver |
Observer class for tracking component changes within a system.
The Observer
class enables systems to monitor specific components, tracking entities as they are added with the specified components.
Components | The types of components to be observed. |
Example usage:
|
inline |
Constructs an Observer for the specified components.
Initializes the observer to monitor entities with the specified components.
|
inlineoverridevirtual |
Retrieves the entities that have been added for the first time with the observed components.
Returns a reference to a vector of entities that were added with the specified components. If no entities were added, an empty vector is returned.
Implements vecs::TypeErasedObserver.
|
inlineoverridevirtual |
Retrieves the entities that have been inserted with the observed components.
Returns a reference to a vector of entities that were inserted with the specified components. If no entities were inserted, an empty vector is returned.
Implements vecs::TypeErasedObserver.
|
inlineoverridevirtual |
Retrieves the entities that have been had the observed components removed.
Returns a reference to a vector of entities that have had the specified components removed. If no components were inserted, an empty vector is returned.
Implements vecs::TypeErasedObserver.