-update README code example (to one that compile)
-remove Entity.instance and gEM, global manager is now gEntityManager
This commit is contained in:
parent
d1c48e4c5f
commit
3b954b732b
11 changed files with 617 additions and 604 deletions
|
|
@ -35,7 +35,7 @@ struct Entity
|
|||
*/
|
||||
T* getComponent(T)() const
|
||||
{
|
||||
/*EntityManager.EntitiesBlock* block = gEM.getMetaData(&this);
|
||||
/*EntityManager.EntitiesBlock* block = gEntityManager.getMetaData(&this);
|
||||
EntityManager.EntityInfo* info = block.type_info;
|
||||
if (T.component_id >= info.deltas.length || info.deltas[T.component_id] == 0)
|
||||
return null;
|
||||
|
|
@ -46,17 +46,17 @@ struct Entity
|
|||
|
||||
void* getComponent(ushort component_id) const
|
||||
{
|
||||
EntityManager.EntitiesBlock* block = gEM.getMetaData(&this);
|
||||
EntityManager.EntitiesBlock* block = gEntityManager.getMetaData(&this);
|
||||
EntityManager.EntityInfo* info = block.type_info;
|
||||
if (component_id >= info.deltas.length || info.deltas[component_id] == 0)
|
||||
return null;
|
||||
|
||||
return (cast(void*)block + info.deltas[component_id] + block.entityIndex(&this) * gEM.components[component_id].size);
|
||||
return (cast(void*)block + info.deltas[component_id] + block.entityIndex(&this) * gEntityManager.components[component_id].size);
|
||||
}
|
||||
|
||||
bool hasComponent(ushort component_id) const
|
||||
{
|
||||
EntityManager.EntitiesBlock* block = gEM.getMetaData(&this);
|
||||
EntityManager.EntitiesBlock* block = gEntityManager.getMetaData(&this);
|
||||
EntityManager.EntityInfo* info = block.type_info;
|
||||
if (component_id >= info.deltas.length || info.deltas[component_id] == 0)return false;
|
||||
return true;
|
||||
|
|
@ -65,7 +65,7 @@ struct Entity
|
|||
EntityMeta getMeta() const
|
||||
{
|
||||
EntityMeta meta;
|
||||
meta.block = gEM.getMetaData(&this);
|
||||
meta.block = gEntityManager.getMetaData(&this);
|
||||
meta.index = meta.block.entityIndex(&this);
|
||||
return meta;
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ struct EntityMeta
|
|||
if (component_id >= info.deltas.length || info.deltas[component_id] == 0)
|
||||
return null;
|
||||
|
||||
return (cast(void*)block + info.deltas[component_id] + index * gEM.components[component_id].size);
|
||||
return (cast(void*)block + info.deltas[component_id] + index * gEntityManager.components[component_id].size);
|
||||
}
|
||||
|
||||
bool hasComponent(ushort component_id) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue