summaryrefslogtreecommitdiff
path: root/src/ecs.hpp
blob: 91202c4c5f417551a949df9a83582ab4919a9c1b (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 "pk.h"
#include "components.hpp"

extern pk_arr_t<Entity_Base *> EntitiesToBeRemoved;
extern pk_arr_t<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);

bool ecs_pk_arr_find_first_matching_pointer(void *search_ptr, void *list_ptr);

Entity_Base *ECS_CreateGenericEntity();
EntityHandle ECS_CreateEntity(Entity_Base *entity, Entity_Base *parentEnt = nullptr);
Entity_Base *ECS_GetEntity(EntityHandle handle);
Entity_Base *ECS_GetEntityByUUID(pk_uuid uuid);
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);
pk_bkt_arr *ECS_GetGrBinds();

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);
pk_bkt_arr *ECS_GetInstances();

#endif /* PKE_ECS_HPP */