Potato Engine
Hobby Game Engine Project
|
A world contains a collection of Entities, Archetypes, and their associated Components. More...
#include <world.h>
Public Types | |
using | RawSelectSignature = void(size_t, EntityId const *, view< void * >) |
Public Member Functions | |
World (World &&)=delete | |
World & | operator= (World &&)=delete |
view< box< Archetype > > | archetypes () const noexcept |
template<typename... Components> | |
EntityId | createEntity (Components const &... components) noexcept |
Creates a new Entity with the provided list of Component data. | |
void | deleteEntity (EntityId entity) noexcept |
Deletes an existing Entity. | |
template<typename Component > | |
void | addComponent (EntityId entityId, Component const &component) noexcept |
Adds a new Component to an existing Entity. More... | |
void | removeComponent (EntityId entityId, ComponentId componentId) noexcept |
Removes a Component from an existing Entity. More... | |
template<typename Component > | |
Component * | getComponentSlow (EntityId entity) noexcept |
Retrieves a pointer to a Component on the specified Entity. More... | |
void * | getComponentSlowUnsafe (EntityId entity, ComponentId component) noexcept |
Retrieves a pointer to a Component on the specified Entity. More... | |
void | selectRaw (view< ComponentId > sortedComponents, view< ComponentId > callbackComponents, delegate_ref< RawSelectSignature > callback) const |
Static Public Attributes | |
static constexpr uint32 | maxSelectComponents = 64 |
Maximum number of Components that can be selected (used in a Query) | |
static constexpr uint32 | maxArchetypeComponents = 256 |
Maximum number of Components that can exist on an Archetype (and hence any single Entity) | |
A world contains a collection of Entities, Archetypes, and their associated Components.
Entities from different Worlds cannot interact.
|
noexcept |
Adds a new Component to an existing Entity.
Changes the Entity's Archetype and home Chunk
|
noexcept |
Retrieves a pointer to a Component on the specified Entity.
This is typically a slow operation. It will incur several table lookups and searches. This should only be used by tools and debug aids, typically, and a Query should be used for runtime code.
|
noexcept |
Retrieves a pointer to a Component on the specified Entity.
This is a type-unsafe variant of getComponentSlow.
|
noexcept |
Removes a Component from an existing Entity.
Changes the Entity's Archetype and home Chunk