Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
A simplified syntax for accessing entity components. More...
#include <CmpPtr.h>
Public Member Functions | |
CmpPtr (const CSimContext &context, entity_id_t ent) | |
CmpPtr (const CSimulation2 &simulation, entity_id_t ent) | |
CmpPtr (CEntityHandle ent) | |
T * | operator-> () |
operator bool () const | |
Private Attributes | |
T * | m |
A simplified syntax for accessing entity components.
E.g. to get the Position
component, write:
where context
is (if you're writing component code) a CSimContext object, or (if you're writing external engine code that makes use of the simulation system) a CSimulation2 object; and ent
is the entity ID.
ent
can be CComponentManager::SYSTEM_ENTITY (if you're writing a component), or CSimulation2::SYSTEM_ENTITY (for external code), if you want to access the global singleton system components.
You should never hold onto a component pointer outside of the method in which you acquire it, because it might get deleted and invalidate your pointer. (Components will never be deleted while inside a simulation method.)
|
inline |
|
inline |
|
inline |