summaryrefslogtreecommitdiff
path: root/src/ecs.hpp
blob: edc1c377e3ea2c39396b5b4fc44a1c051bf2f1be (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
38
39
40
41
42
#ifndef PKE_ECS_HPP
#define PKE_ECS_HPP

#include "pk.h"
#include "components.hpp"

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

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();

pke_component_event *ECS_CreateEv(Entity_Base *entity, pk_uuid uuid);
pke_component_event *ECS_GetEv(PkeEventHandle handle);
void ECS_GetEvs(Entity_Base *entity, pk_arr_t<pke_component_event *> &arr);
pk_bkt_arr *ECS_GetEvs();

#endif /* PKE_ECS_HPP */