ECSTASY
All in the name
Loading...
Searching...
No Matches
DeletionStack.cpp
Go to the documentation of this file.
1
11
12#include "DeletionStack.hpp"
14
15namespace ecstasy
16{
17 DeletionStack::DeletionStack(Registry &registry) : _registry(registry)
18 {
19 }
20
22 {
23 if (_killed.size() > 0)
25 }
26
28 {
29 _killed.push_back(entity);
30 }
31
32 [[nodiscard]] size_t DeletionStack::size() const noexcept
33 {
34 return _killed.size();
35 }
36} // namespace ecstasy
Helper to manage entity deletion safely within an iteration.
Registry class definition.
~DeletionStack()
Destroy the Deletion Stack, calling Registry::eraseEntities() with all the entity marked for deletion...
Registry & _registry
Registry attached to this stack.
size_t size() const noexcept
Return the number of entities marked for deletion.
void push(Entity entity)
Mark an entity for deletion upon destruction of this instance.
DeletionStack(Registry &registry)
Construct a new Deletion Stack attached to a given registry.
std::vector< Entity > _killed
Entities marked for deletion.
Encapsulate an index to an entity.
Definition Entity.hpp:35
Base of an ECS architecture.
Definition Registry.hpp:82
size_t eraseEntities(std::span< Entity > entities)
Instantly erase multiple entities and their components from the registry.
Definition Registry.cpp:62
Namespace containing all symbols specific to ecstasy.
Definition ecstasy.hpp:30