summaryrefslogtreecommitdiff
path: root/src/ecs.hpp
blob: b25fdb7aa03859e581a3ab713e05343aca2200c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef PKE_ECS_HPP
#define PKE_ECS_HPP

#include "dynamic-array.hpp"
#include "pk.h"
#include "components.hpp"

extern DynArray<Entity_Base *> EntitiesToBeRemoved;
extern DynArray<Entity_Base *> EntitiesWithExcessInstances;

void ECS_Init();
void ECS_Teardown();
void ECS_Tick_Early(double delta);
void ECS_Tick(double delta);
void ECS_Tick_Late(double delta);

Entity_Base *ECS_CreateGenericEntity();
EntityHandle ECS_CreateEntity(Entity_Base *entity, Entity_Base *parentEnt = nullptr);
Entity_Base *ECS_GetEntity(EntityHandle handle);
void ECS_MarkForRemoval(Entity_Base *entity);

void ECS_HandleCollision(CompInstance *lhs, CompInstance *rhs);

CompGrBinds *ECS_CreateGrBinds(Entity_Base *);
CompGrBinds *ECS_GetGrBinds(GrBindsHandle grBindsHandle);
void ECS_GetGrBinds(Entity_Base *entity, pk_arr_t<CompGrBinds *> &arr);
uint64_t ECS_GetGrBinds_BucketCount();
CompGrBinds *ECS_GetGrBinds(pk_handle_bucket_index_T bucketIndex, pk_handle_item_index_T &itemCount);

CompInstance *ECS_CreateInstance(Entity_Base *entity, pk_uuid uuid, CompGrBinds *entityTypeGrBinds, InstPos *instance_pos);
CompInstance *ECS_GetInstance(InstanceHandle instanceHandle);
void ECS_GetInstances(Entity_Base *entity, pk_arr_t<CompInstance *> &arr);
void ECS_UpdateInstance(CompInstance *instance, const InstPos &instPos, bool overridePhysics = false);
uint64_t ECS_GetInstances_BucketCount();
CompInstance *ECS_GetInstances(pk_handle_bucket_index_T bucketIndex, pk_handle_item_index_T &itemCount);

#endif /* PKE_ECS_HPP */