Merge branch 'master' of https://gitlab.com/Mergul/bubel-ecs.git into remove_structure_top_mixin

# Conflicts:
#	tests/basic.d
This commit is contained in:
Mergul 2021-02-27 17:30:31 +01:00
commit 8b2793fc57
13 changed files with 200 additions and 97 deletions

View file

@ -129,6 +129,15 @@ export struct EntityTemplate
if(becsID!T >= info.tmpl_deltas.length || info.tmpl_deltas[becsID!T] == ushort.max)return null;
return cast(T*)(entity_data.ptr + info.tmpl_deltas[becsID!T]);
}
/************************************************************************************************************************
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]);
}
}
/************************************************************************************************************************