25template <
typename COMPONENT>
59template <
typename COMPONENT_TYPE>
85 this->
fieldNames = (
const char**)T::Traits::field_names;
118template <
typename COMPONENT>
126 "Component '%s' is not registered! Make sure you call Game::RegisterComponent<T>() for all component types before "
128 COMPONENT::Traits::name
These are registered to the attribute registry so that we can add more functionality to attributes.
Definition component.h:75
const size_t * fieldByteOffsets
Definition component.h:105
const char * fullyQualifiedName
Definition component.h:102
const char * GetFullyQualifiedName() const
Definition component.h:94
const char ** GetFieldNames() const
Definition component.h:95
const char ** fieldNames
Definition component.h:103
const char ** GetFieldTypenames() const
Definition component.h:96
const char * componentName
Definition component.h:101
const char ** fieldTypenames
Definition component.h:104
void(*)(Game::World *, Game::Entity, void *) ComponentInitFunc
Definition component.h:90
const size_t * GetFieldByteOffsets() const
Definition component.h:97
ComponentInitFunc Init
Definition component.h:91
size_t numFields
Definition component.h:106
ComponentInterface(Util::StringAtom name, T const &defaultValue, uint32_t flags)
construct from template type, with default value.
Definition component.h:79
const char * GetName() const
Definition component.h:93
size_t const GetNumFields() const
Definition component.h:98
A container of entities, their components, and processors.
Definition attribute.h:29
Attribute()=default
default constructor
Util::StringAtom name
name of attribute
Definition attribute.h:49
static AttributeId GetAttributeId(Util::StringAtom name)
get attribute id from name
Definition attributeregistry.h:212
static bool IsRegistered()
Check if a type is registered.
Definition attributeregistry.h:79
A StringAtom.
Definition stringatom.h:22
void __cdecl n_error(const char *msg,...)
This function is called when a serious situation is encountered which requires abortion of the applic...
Definition debug.cc:138
Game::EditorState.
Definition graphicsmanager.h:60
MemDb::AttributeId ComponentId
Definition componentid.h:15
ComponentFlags
Specifies special behaviour for a components.
Definition component.h:33
@ COMPONENTFLAG_NONE
regular component
Definition component.h:35
@ COMPONENTFLAG_DECAY
Component will decay.
Definition component.h:38
ComponentId GetComponentId()
Returns a component id, based on template type.
Definition component.h:120
AttributeId GetAttributeId()
Definition attributeregistry.h:67
Contains data for components flagged with COMPONENTFLAG_DECAY, that has been deleted this frame.
Definition component.h:47
uint32_t capacity
Definition component.h:49
void * buffer
Definition component.h:50
uint32_t size
Definition component.h:48
Used for registering component types to the game world.
Definition component.h:61
OnInitFunc OnInit
initialization function to run for the component, or nullptr if not needed.
Definition component.h:67
bool decay
Set to true if the component should end up in the decay buffer before being completely destroyed.
Definition component.h:65
void(*)(Game::World *, Game::Entity, COMPONENT_TYPE *) OnInitFunc
Definition component.h:62
An entity is essentially just an Id with some utility functions attached.
Definition entity.h:35
Definition attributeid.h:19