This file contains all the API changes between this C++ port and the original Java version of Ashley.
-
Component
virtual std::type_index identify() const;
Added to help with type identification; can be called by Component-derived types using a base classComponent *
to identify the derived class polymorphically.
-
ComponentType
operator==
andoperator!=
Two ComponentTypes are equal if they have the same index, i.e. they represent the same type.
-
ComponentMapper
getMapper()
Renamed fromgetFor
to make more sense since this templated version needs no non-template arguments.
-
Engine
getEntitiesFor
The C++ version is mutable but should not be changed; you get a pointer to a vector ofEntity*
. Modifiying the vector may cause errors and is not supported.SystemComparator
->bool systemPriorityComparator()
Private static comparator class in Java becomes a public static comparison function in C++.
-
Entity
add
andremove
Instead of accepting a component directly, can take the templated Component type and perfect forward into the appropriate (copy-/move-)constructor which saves typing and increases efficiency. Also provides an overload taking components as rvalue references to unique_ptrs which are moved from.getComponents()
The C++ version is mutable but shouldn't be changed; you get a pointer to a vector ofComponent *
. Modifiying the vector may cause errors and is not supported.operator==
andoperator!=
Two entities compare equal if they have the same index number.- Relational comparison operators
<, <=, >, >=
Defined based on index number. toggleComponentOperationHandler()
Allows power users to temporarily interfere with how components are added or removed from Entities by changing the attached component operation handler. Should be used with extreme caution.
-
EntitySystem
virtual std::type_index identify() const;
Same reasons as withComponent::identify()
.=, !=, <, <=, >, >=
Comparison operators
Defined based on priority; lower priority means first to execute, soa < b == true
meansa
will execute first.
-
Family
- Constructor
There is a visible constructor to make Family usable with smart pointer classes. The first argument is a private dummy type and you shouldn't try to use it; use a version of Family::getFor instead. hashCode()
->std::hash
Family.hpp contains a specialisation ofstd::hash
to allow Family instances to be used as keys instd::unordered_map
s. It uses the same hash as in Java.operator==
andoperator!=
Defined based on index; two families are equal if they represent the same selection of components.
- Constructor
-
ObjectPool and Poolable
- Similar to LibGDX's Pool class and Pool.Poolable interface. See the docs for more details about these classes.
- Both found in
#include "Ashley/util/ObjectPools.hpp"