-change ecsID to becsID

-change component_id/system_id to becsID in demos
This commit is contained in:
Mergul 2021-02-27 17:25:13 +01:00
parent a926b79223
commit a6d92cb21b
17 changed files with 296 additions and 272 deletions

View file

@ -8,7 +8,7 @@ module bubel.ecs.entity;
import bubel.ecs.system;
import bubel.ecs.manager;
import bubel.ecs.traits : ecsID;
public import bubel.ecs.traits : becsID;
/************************************************************************************************************************
Entity ID structure. Used as reference to Entity. Pointer to entity should be ever used to store entity reference!
@ -41,7 +41,7 @@ struct Entity
return null;
return cast(T*)(cast(void*)block + info.deltas[T.component_id] + block.entityIndex(&this) * T.sizeof);*/
return cast(T*)getComponent(ecsID!T);
return cast(T*)getComponent(becsID!T);
}
void* getComponent(ushort component_id) const
@ -82,7 +82,7 @@ struct EntityMeta
if (T.component_id >= info.deltas.length || info.deltas[T.component_id] == 0)
return null;
return cast(T*)(cast(void*)block + info.deltas[T.component_id] + index * T.sizeof);*/
return cast(T*)getComponent(ecsID!T);
return cast(T*)getComponent(becsID!T);
}
void* getComponent(ushort component_id) const
@ -126,8 +126,8 @@ export struct EntityTemplate
*/
T* getComponent(T)() nothrow @nogc
{
if(ecsID!T >= info.tmpl_deltas.length || info.tmpl_deltas[ecsID!T] == ushort.max)return null;
return cast(T*)(entity_data.ptr + info.tmpl_deltas[ecsID!T]);
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]);
}
}