-added filterEntity callback (used to filter EntityInfos for system, better control than simply @optional)
-removed some redundant code (two times same code) -added some common functions
This commit is contained in:
parent
13c82acad4
commit
3c1c67efd0
4 changed files with 155 additions and 25 deletions
|
|
@ -128,6 +128,15 @@ export struct EntityTemplate
|
|||
if(T.component_id >= info.tmpl_deltas.length || info.tmpl_deltas[T.component_id] == ushort.max)return null;
|
||||
return cast(T*)(entity_data.ptr + info.tmpl_deltas[T.component_id]);
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
Get specified component. If component doesn't exist function return null. Returned pointer is valid during EntityTemplate lifetime.
|
||||
*/
|
||||
void* getComponent(ushort component_id) const nothrow @nogc
|
||||
{
|
||||
if(component_id >= info.tmpl_deltas.length || info.tmpl_deltas[component_id] == ushort.max)return null;
|
||||
return cast(void*)(entity_data.ptr + info.tmpl_deltas[component_id]);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue