2025-03-11 00:41:24 -06:00
|
|
|
#ifndef ARC_STD_ENTITY_H_
|
|
|
|
|
#define ARC_STD_ENTITY_H_
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-03-14 01:02:00 -06:00
|
|
|
#include "arc/std/array.h"
|
|
|
|
|
#include "arc/std/bool.h"
|
2025-03-11 00:41:24 -06:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief an entity component system type
|
|
|
|
|
*/
|
|
|
|
|
typedef struct ARC_EntitySystem ARC_EntitySystem;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief an entity component system type
|
|
|
|
|
*/
|
|
|
|
|
typedef uint32_t ARC_Entity;
|
|
|
|
|
|
2025-03-14 01:02:00 -06:00
|
|
|
/**
|
|
|
|
|
* @brief an entity component system type
|
|
|
|
|
*/
|
|
|
|
|
typedef enum ARC_EntityFlags {
|
|
|
|
|
ARC_ENTITY_DEAD = 0,
|
|
|
|
|
ARC_ENTITY_ALIVE = 1
|
|
|
|
|
} ARC_EntityFlags;
|
|
|
|
|
|
2025-03-13 19:22:27 -06:00
|
|
|
/**
|
|
|
|
|
* @brief an entity component system type
|
|
|
|
|
*/
|
|
|
|
|
typedef uint32_t ARC_EntityComponent;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief
|
|
|
|
|
*/
|
|
|
|
|
typedef void (* ARC_EntityCoponent_CreateEmptyFn)(void **type);
|
|
|
|
|
|
2025-03-11 00:41:24 -06:00
|
|
|
/**
|
|
|
|
|
* @brief
|
|
|
|
|
*/
|
|
|
|
|
void ARC_EntitySystem_Create(ARC_EntitySystem **entitySystem);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief destroys an ARC_EntitySystem
|
|
|
|
|
*
|
2025-03-14 01:02:00 -06:00
|
|
|
* @param[in] entitySystem ARC_EntitySystem to free
|
2025-03-11 00:41:24 -06:00
|
|
|
*/
|
|
|
|
|
void ARC_EntitySystem_Destroy(ARC_EntitySystem *entitySystem);
|
|
|
|
|
|
2025-03-14 01:02:00 -06:00
|
|
|
/**
|
|
|
|
|
* @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);
|
2025-03-13 19:22:27 -06:00
|
|
|
|
2025-03-14 01:02:00 -06:00
|
|
|
/**
|
|
|
|
|
* @brief
|
|
|
|
|
*/
|
|
|
|
|
void ARC_EntitySystem_ReleaseEntity(ARC_EntitySystem *entitySystem, ARC_Entity entity);
|
2025-03-13 19:22:27 -06:00
|
|
|
|
2025-03-14 01:02:00 -06:00
|
|
|
/**
|
|
|
|
|
* @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, uint32_t components);
|
2025-03-13 19:22:27 -06:00
|
|
|
|
2025-03-11 00:41:24 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // !ARC_STD_ENTITY_H_
|