This function is used to destroy an entity.
void dg_entity_destroy(dg_entity_t *entity);
dg_entity_destroy(entity);
void dg_entity_destroy(dg_entity_t *entity)
{
dg_array_t *tmp = 0;
if (!entity)
return;
tmp = entity->components;
while (tmp) {
dg_component_destroy(tmp->data);
tmp = tmp->next;
}
dg_arr_free_all(&(entity->components));
free(entity);
}