#ifndef ARC_STD_ENTITY_H_ #define ARC_STD_ENTITY_H_ #ifdef __cplusplus extern "C" { #endif #include "arc/std/array.h" #include "arc/std/bool.h" #include /** * @brief an entity component system type */ typedef struct ARC_EntitySystem ARC_EntitySystem; /** * @brief an entity component system type */ typedef uint32_t ARC_Entity; /** * @brief an entity component system type */ typedef enum ARC_EntityFlags { ARC_ENTITY_DEAD = 0, ARC_ENTITY_ALIVE = 1 } ARC_EntityFlags; /** * @brief an entity component system type */ typedef uint32_t ARC_EntityComponent; /** * @brief */ typedef void (* ARC_EntityCoponent_CreateEmptyFn)(void **type); /** * @brief */ void ARC_EntitySystem_Create(ARC_EntitySystem **entitySystem); /** * @brief destroys an ARC_EntitySystem * * @param[in] entitySystem ARC_EntitySystem to free */ void ARC_EntitySystem_Destroy(ARC_EntitySystem *entitySystem); /** * @brief registers space for a component and an id for the compenent within the entity system * * @note this function will set arc_errno if the components run out of space * * @param[in] entitySystem the entity system to register the component to * @param[in] componentSize the size of the component to register * * @return an id for for the component */ uint32_t ARC_EntitySystem_RegisterComponent(ARC_EntitySystem *entitySystem, uint32_t componentSize); /** * @brief */ ARC_Entity ARC_EntitySystem_InitEntity(ARC_EntitySystem *entitySystem); /** * @brief */ void ARC_EntitySystem_ReleaseEntity(ARC_EntitySystem *entitySystem, ARC_Entity entity); /** * @brief */ void ARC_EntitySystem_AddComponent(ARC_EntitySystem *entitySystem, ARC_Entity entity, ARC_EntityComponent component, void *data); /** * @brief */ ARC_Bool ARC_EntitySystem_HasComponent(ARC_EntitySystem *entitySystem, ARC_Entity entity, ARC_EntityComponent component); /** * @brief */ void *ARC_EntitySystem_GetComponentData(ARC_EntitySystem *entitySystem, ARC_Entity entity, ARC_EntityComponent component); /** * @brief */ ARC_Array ARC_EntitySystem_QueryComponentsData(ARC_EntitySystem *entitySystem, ARC_Array components); #ifdef __cplusplus } #endif #endif // !ARC_STD_ENTITY_H_