![]() |
Shkyera Engine
Easy to use, game engine for Python
|
#include <EntityProvider.hpp>
Public Member Functions | |
EntityProvider () | |
EntityProvider (const EntityProvider &provider) | |
EntityProvider & | operator= (const EntityProvider &other) |
~EntityProvider ()=default | |
Default destructor. | |
Entity | requestEntity () |
Request an available entity ID. Returns an entity ID from the pool of available IDs, allocating more if necessary. | |
Private Attributes | |
std::atomic< Entity > | _nextEntity |
Manages a pool of reusable entity identifiers. Tracks available entity IDs and supports requesting new IDs and returning unused ones for reuse.
shkyera::EntityProvider::EntityProvider | ( | ) |
Construct an EntityProvider with a specified number of entities. Initializes the pool of entity IDs (from 0 to numEntities - 1
) and stores them in the queue for reuse.
shkyera::EntityProvider::EntityProvider | ( | const EntityProvider & | provider | ) |
|
default |
Default destructor.
EntityProvider & shkyera::EntityProvider::operator= | ( | const EntityProvider & | other | ) |
Entity shkyera::EntityProvider::requestEntity | ( | ) |
Request an available entity ID. Returns an entity ID from the pool of available IDs, allocating more if necessary.
|
private |
Tracks the total number of entity IDs allocated so far.