26 lines
686 B
C
26 lines
686 B
C
|
#include <voxula/internals/ecs/entity.h>
|
||
|
#include <voxula/internals/ecs/head.h>
|
||
|
|
||
|
vecs_entity_s vecs_summon(void *ecs_pointer)
|
||
|
{
|
||
|
vecs_s *ecs = ecs_pointer;
|
||
|
|
||
|
vecs_entity_s entity;
|
||
|
entity.head_structure = ecs;
|
||
|
entity.uuid = vx_new_uuid(ecs->uuid_table);
|
||
|
|
||
|
vecs_shadow_s *shadow = vx_pool(ecs->shadow_pool);
|
||
|
shadow->identifier = entity.uuid;
|
||
|
shadow->first_tag = NULL;
|
||
|
|
||
|
vecs_register_entity(&ecs->lookup_map, shadow);
|
||
|
return entity;
|
||
|
}
|
||
|
|
||
|
void vecs_vanish(vecs_entity_s *entity)
|
||
|
{
|
||
|
vecs_s *ecs = entity->head_structure;
|
||
|
vecs_shadow_s *shadow = vecs_lookup_entity(&ecs->lookup_map, entity->uuid);
|
||
|
vecs_unregister_entity(&ecs->lookup_map, shadow);
|
||
|
}
|