#ifndef CORE_COMPONENTS_H #define CORE_COMPONENTS_H #include "core/HashMap.h" #include "core/List.h" typedef size_t CoreEntity; typedef struct { CoreHashMap entityToIndex; CoreList indexToEntity; CoreList components; } CoreComponents; typedef struct { CoreEntity entity; void* component; } CoreComponentNode; typedef struct { const CoreEntity* indexToEntity; const CoreEntity* indexToEntityEnd; void* component; void* componentEnd; size_t componentSize; CoreComponentNode node; } CoreComponentIterator; void coreInitComponents(CoreComponents* c, size_t componentSize); void coreDestroyComponents(CoreComponents* c); void* coreComponentsGetOrAdd(CoreComponents* c, CoreEntity e); void* coreComponentsSearch(CoreComponents* c, CoreEntity e); bool coreComponentsRemove(CoreComponents* c, CoreEntity e); void coreInitComponentsIterator(CoreComponentIterator* ci, CoreComponents* c); bool coreComponentsHasNext(CoreComponentIterator* ci); CoreComponentNode* coreComponentsNext(CoreComponentIterator* ci); void* coreComponentsBegin(CoreComponents* c); void* coreComponentsEnd(CoreComponents* c); #endif