34 lines
856 B
C
34 lines
856 B
C
#pragma once
|
|
|
|
#include <Core/Container/Vector.h>
|
|
#include <Entity/entity_common.h>
|
|
|
|
struct World;
|
|
struct EntityTemplate;
|
|
struct Entity;
|
|
struct Class;
|
|
|
|
struct typed_entity_array
|
|
{
|
|
Arena* arena;
|
|
EntityTemplate* array;
|
|
size_t count;
|
|
};
|
|
|
|
struct EntityManager
|
|
{
|
|
static EntityID ID;
|
|
|
|
// TODO: Should be a pool
|
|
VectorArena<Entity, 100'000> Entities;
|
|
|
|
typed_entity_array by_type[ENTITY(Count)];
|
|
};
|
|
|
|
void InitEntityManager(NonNullPtr<World> world);
|
|
void ShutdownEntityManager();
|
|
EntityManager& GetEntityManager();
|
|
EntityTemplate* RegisterEntity(EntityManager& manager, Entity* base, DerivedType entity);
|
|
[[nodiscard]] Entity* allocate_entity(EntityManager& manager, NonNullPtr<Class> derived_type_class);
|
|
void UpdateEntityManager(EntityManager& manager);
|