basics of ecs written, working on query, needs testing
This commit is contained in:
parent
ba09aff914
commit
c078ce907f
2 changed files with 205 additions and 16 deletions
|
|
@ -5,6 +5,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "arc/std/array.h"
|
||||
#include "arc/std/bool.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
|
|
@ -17,6 +19,14 @@ typedef struct ARC_EntitySystem ARC_EntitySystem;
|
|||
*/
|
||||
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
|
||||
*/
|
||||
|
|
@ -35,15 +45,51 @@ void ARC_EntitySystem_Create(ARC_EntitySystem **entitySystem);
|
|||
/**
|
||||
* @brief destroys an ARC_EntitySystem
|
||||
*
|
||||
* @param[in] vector ARC_EntitySystem to free
|
||||
* @param[in] entitySystem ARC_EntitySystem to free
|
||||
*/
|
||||
void ARC_EntitySystem_Destroy(ARC_EntitySystem *entitySystem);
|
||||
|
||||
void ARC_EntitySystem_RegisterComponent(ARC_EntitySystem *entitySystem, uint32_t componentSize);
|
||||
/**
|
||||
* @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);
|
||||
|
||||
//void ARC_EntitySystem_RunSystem(ARC_EntitySystem *entitySystem, ARC_Component component);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
ARC_Entity ARC_EntitySystem_InitEntity(ARC_EntitySystem *entitySystem);
|
||||
|
||||
void ARC_EntitySystem_Run(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, uint32_t components);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue