Component classes and functions.
More...
Component classes and functions.
#define CORGI_DEFINE_COMPONENT |
( |
|
ComponentType, |
|
|
|
DataType |
|
) |
| |
Value:
#define CORGI_DEFINE_COMPONENT_ID_LOOKUP(DataType)
Definition: component_id_lookup.h:88
Handles defining the storage location for the Component for a given Component type and data type. It should be placed at the top of the .cpp file for that Component (after the includes but before the namespaces).
- Parameters
-
ComponentType | The name of the Component class. |
DataType | The name of the struct that holds the Component data. (i.e. The type that the Component was specialized for.) |
#define CORGI_DEFINE_COMPONENT_ID_LOOKUP |
( |
|
DataType | ) |
|
Value:
}
const ComponentId kInvalidComponent
A sentinel value to represent an invalid Component.
Definition: entity_common.h:44
uint16_t ComponentId
This represents the ID of a Component.
Definition: entity_common.h:36
This macro handles defining the storage location for the Component ID for a given data type. It is usually invoked by CORGI_DEFINE_COMPONENT, rather than invoking it directly.
- Parameters
-
DataType | The name of the struct that holds the Component data. (i.e. The type that the Component was specialized for.) |
#define CORGI_REGISTER_COMPONENT |
( |
|
ComponentType, |
|
|
|
DataType |
|
) |
| |
Value:
#define CORGI_REGISTER_COMPONENT_ID_LOOKUP(DataType)
Definition: component_id_lookup.h:73
Each Component needs to use this macro in its header, in order to declare the necessary constants for lookups.
- Note
- Since the macro includes its own namespace defintions, this should ideally be called outside of any namespaces.
- Parameters
-
ComponentType | The name of the Component class. |
DataType | The name of the struct that holds the Component data. (i.e. The type that the Component was specialized for.) |
#define CORGI_REGISTER_COMPONENT_ID_LOOKUP |
( |
|
DataType | ) |
|
Value:namespace corgi { \
template <> \
struct ComponentIdLookup<DataType> { \
}; \
}
uint16_t ComponentId
This represents the ID of a Component.
Definition: entity_common.h:36
This macro handles the lower level job of generating code to associate data with a type. It is usually invoked by CORGI_REGISTER_COMPONENT, rather than invoking it directly. (Since registration of a Component requires multiple datatype/ID registrations.)
- Parameters
-
DataType | The name of the struct that holds the Component data. (i.e. The type that the Component was specialized for.) |