}
/*!
- \brief Returns a reference to a component belonging to the given
+ \brief Returns a pointer to a component belonging to the given
Entity.
- This function will return a reference to a Component regardless of
- whether or not the Entity actually owns the reference. If the Entity
+ This function will return a pointer to a Component regardless of
+ whether or not the Entity actually owns the Component. If the Entity
doesn't own the Component, changes to the Component will not affect
any Entity. It is recommended to use hasComponent() to determine if
the Entity actually owns that Component.
+
+ If the given Component is unknown to the Manager, then this function
+ will return a nullptr.
*/
template <typename Component>
Component* getEntityData(const std::size_t& index)
}
/*!
- \brief Returns a reference to a component belonging to the given
+ \brief Returns a pointer to a component belonging to the given
Entity.
Note that this function is the same as getEntityData().
- This function will return a reference to a Component regardless of
- whether or not the Entity actually owns the reference. If the Entity
+ This function will return a pointer to a Component regardless of
+ whether or not the Entity actually owns the Component. If the Entity
doesn't own the Component, changes to the Component will not affect
any Entity. It is recommended to use hasComponent() to determine if
the Entity actually owns that Component.
+
+ If the given Component is unknown to the Manager, then this function
+ will return a nullptr.
*/
template <typename Component>
Component* getEntityComponent(const std::size_t& index)
}
/*!
- \brief Returns a const reference to a component belonging to the
+ \brief Returns a const pointer to a component belonging to the
given Entity.
- This function will return a const reference to a Component
- regardless of whether or not the Entity actually owns the reference.
+ This function will return a const pointer to a Component
+ regardless of whether or not the Entity actually owns the Component.
If the Entity doesn't own the Component, changes to the Component
will not affect any Entity. It is recommended to use hasComponent()
to determine if the Entity actually owns that Component.
+
+ If the given Component is unknown to the Manager, then this function
+ will return a nullptr.
*/
template <typename Component>
const Component* getEntityData(const std::size_t& index) const
}
/*!
- \brief Returns a const reference to a component belonging to the
+ \brief Returns a const pointer to a component belonging to the
given Entity.
Note that this function is the same as getEntityData() (const).
- This function will return a const reference to a Component
- regardless of whether or not the Entity actually owns the reference.
+ This function will return a const pointer to a Component
+ regardless of whether or not the Entity actually owns the Component.
If the Entity doesn't own the Component, changes to the Component
will not affect any Entity. It is recommended to use hasComponent()
to determine if the Entity actually owns that Component.
+
+ If the given Component is unknown to the Manager, then this function
+ will return a nullptr.
*/
template <typename Component>
const Component* getEntityComponent(const std::size_t& index) const
will be overwritten by the newly created Component with the given
arguments.
+ If the Entity is not alive or the given Component is not known to
+ the Manager, then nothing will change.
+
Example:
\code{.cpp}
struct C0
Signature.
The function object given to this function must accept std::size_t
- as its first parameter and Component references for the rest of the
+ as its first parameter and Component pointers for the rest of the
parameters. Tags specified in the Signature are only used as
filters and will not be given as a parameter to the function.
Example:
\code{.cpp}
manager.forMatchingSignature<TypeList<C0, C1, T0>>([] (
- std::size_t ID, C0& component0, C1& component1) {
+ std::size_t ID, C0* component0, C1* component1) {
// Lambda function contents here
},
4 // four threads
Signature.
The function pointer given to this function must accept std::size_t
- as its first parameter and Component references for the rest of the
+ as its first parameter and Component pointers for the rest of the
parameters. Tags specified in the Signature are only used as
filters and will not be given as a parameter to the function.
Example:
\code{.cpp}
- auto function = [] (std::size_t ID, C0& component0,
- C1& component1) {
+ auto function = [] (std::size_t ID, C0* component0,
+ C1* component1) {
// Lambda function contents here
};
manager.forMatchingSignaturePtr<TypeList<C0, C1, T0>>(
Example:
\code{.cpp}
manager.addForMatchingFunction<TypeList<C0, C1, T0>>([] (
- std::size_t ID, C0& component0, C1& component1) {
+ std::size_t ID, C0* component0, C1* component1) {
// Lambda function contents here
});
Example:
\code{.cpp}
manager.addForMatchingFunction<TypeList<C0, C1, T0>>([] (
- std::size_t ID, C0& component0, C1& component1) {
+ std::size_t ID, C0* component0, C1* component1) {
// Lambda function contents here
});
\code{.cpp}
std::size_t id =
manager.addForMatchingFunction<TypeList<C0, C1, T0>>(
- [] (std::size_t ID, C0& c0, C1& c1) {
+ [] (std::size_t ID, C0* c0, C1* c1) {
// Lambda function contents here
});
Example:
\code{.cpp}
manager.addForMatchingFunction<TypeList<C0, C1, T0>>([] (
- std::size_t ID, C0& component0, C1& component1) {
+ std::size_t ID, C0* component0, C1* component1) {
// Lambda function contents here
});