paul_ecs.h
IntroductionEntity Component System (ECS) library for C/C++. DiscussionImplementation is included when PAUL_ECS_IMPLEMENTATION or PAUL_IMPLEMENTATION is defined.
Functions
ecs_componentCreate a new component entity_t ecs_component( world_t *world, size_t size_of_component); ParametersReturn ValueReturns a new component entity ecs_deleteDelete an entity void ecs_delete( world_t *world, entity_t e); Parametersecs_findFind entities matching component requirements entity_t* ecs_find( world_t *world, filter_system_t filter, int *result_count, int component_count, ...); ParametersReturn ValueReturns an array of matching entities ecs_queryQuery entities and execute a function on each void ecs_query( world_t *world, system_t fn, filter_system_t filter, int component_count, ...); Parametersecs_spawnCreate a new entity ParametersReturn ValueReturns a new entity ecs_stepExecute all systems in the world Parametersecs_systemCreate a new system entity_t ecs_system( world_t *world, system_t fn, int component_count, ...); ParametersReturn ValueReturns a new system entity ecs_worldCreate a new ECS world Return ValueReturns a new ECS world ecs_world_destroyDestroy an ECS world void ecs_world_destroy( world_t **world); Parametersentity_cmpCompare two entities int entity_cmp( entity_t a, entity_t b); ParametersReturn ValueReturns non-zero if entities are equal entity_getGet component data from an entity void* entity_get( world_t *world, entity_t e, entity_t c); ParametersReturn ValueReturns a pointer to the component data or NULL entity_giveGive a component to an entity void* entity_give( world_t *world, entity_t e, entity_t c); ParametersReturn ValueReturns a pointer to the component data entity_hasCheck if an entity has a component int entity_has( world_t *world, entity_t e, entity_t c); ParametersReturn ValueReturns non-zero if the entity has the component entity_isaCheck if an entity is of a specific type int entity_isa( world_t *world, entity_t e, int type); ParametersReturn ValueReturns non-zero if the entity is of the given type entity_isnilCheck if an entity is nil int entity_isnil( entity_t e); ParametersReturn ValueReturns non-zero if the entity is nil entity_isvalidCheck if an entity is valid int entity_isvalid( world_t *world, entity_t e); ParametersReturn ValueReturns non-zero if the entity is valid entity_removeRemove a component from an entity void entity_remove( world_t *world, entity_t e, entity_t c); Parametersentity_setSet component data for an entity void entity_set( world_t *world, entity_t e, entity_t c, void *data); ParametersConstantsecs_nilextern const uint64_t ecs_nil; DiscussionNil entity ID value ecs_nil_entityextern const entity_t ecs_nil_entity; DiscussionNil entity value Typedefsentity_ttypedef union entity { struct { uint32_t id; uint16_t version; uint8_t alive; uint8_t type; }; uint64_t value; } entity_t; FieldsDiscussionEntity union representing ECS entities filter_system_ttypedef int( *filter_system_t)( entity_t); ParametersReturn ValueReturns non-zero if the entity matches the filter DiscussionFilter system function type system_ttypedef void( *system_t)( entity_t); ParametersDiscussionSystem function type world_ttypedef struct world world_t; DiscussionECS world structure Enumerated TypesECSenum { ECS_ENTITY, ECS_COMPONENT, ECS_SYSTEM }; Constants
Discussionentity types |