- Fixed overload of
World::contains
being invalid when using two template arguments.
-
Added
World::each
overload where the function argument takes in anEntity
as the first parameter. -
Replace
std::unordered_map
inComponentArray
with a sparse to speed up entity -> component lookup.
- Renamed
World::has_component
toWorld::contains
, andWorld::remove_component
toWorld::remove
. This was done to be more consistent with theWorld::pack
andWorld::unpack
API where the component word is implied. UnlikeWorld::has_component
,World::contains
can take multiple components as template parameters.
-
Added entity versions. Previously when an entity was destroyed there was a possibility that if the entity id was later reused and assigned to a new entity, the destroyed Entity would now refer to the components of the newly assigned entity.
Entity
continues to be defined as an integer, but now the integer id contains both an index and a version number. The version number is incremented each time an entity index is reused, making it impossible for a new entity to take on the same id as a destroyed entity. -
Added variadic version of
World::pack
which can take more than one component. -
Removed
two::EventDispatcher
.World
now handles event channels. -
Fixed
World::view<>(true)
returningNullEntity
. UseWorld::unsafe_view_all
to iterate through all entities including theNullEntity
.
- Added
World::each
as an alternative toWorld::view
.