-registering same system multiple times only replace pointer for callback

-added export attributes (required by windows to make DLL library, not work at now due to DMD bugs)
-interface D files to import
This commit is contained in:
Mergul 2018-09-18 13:28:04 +02:00
parent cb0f56b0fb
commit d0fcdba6cd
20 changed files with 1322 additions and 105 deletions

30
import/ecs/entity.di Normal file
View file

@ -0,0 +1,30 @@
// D import file generated from 'source\ecs\entity.d'
module ecs.entity;
import ecs.manager;
struct EntityID
{
uint id;
uint counter;
}
struct Entity
{
EntityID id;
void updateID();
T* getComponent(T)()
{
EntityManager.EntitiesBlock* block = gEM.getMetaData(&this);
EntityManager.EntityInfo* info = block.type_data;
if (T.component_id >= info.deltas.length || info.deltas[T.component_id] == 0)
return null;
return cast(T*)(cast(void*)&this + info.deltas[T.component_id]);
}
}
export struct EntityTemplate
{
ubyte[] entity_data;
EntityManager.EntityInfo* info;
T* getComponent(T)()
{
return cast(T*)(entity_data.ptr + info.deltas[T.component_id]);
}
}