Flecs: Has, Owns, Shares
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
Has, Owns, Shares
C API » Macro API » Type Safe API » Entity API
Collaboration diagram for Has, Owns, Shares:

## Macros
#define | ecs_has(world, entity, T)
#define | ecs_has_pair(world, entity, first, second)
#define | ecs_owns_pair(world, entity, first, second)
#define | ecs_owns(world, entity, T)
#define | ecs_shares_id(world, entity, id)
#define | ecs_shares_pair(world, entity, first, second)
#define | ecs_shares(world, entity, T)
#define | ecs_get_target_for(world, entity, rel, T)

## Detailed Description

## Macro Definition Documentation

## ◆ ecs_get_target_for

#define ecs_get_target_for | ( |  | world,
|  |  | entity,
|  |  | rel,
|  |  | T )

Value:
ecs_get_target_for_id(world, entity, rel, ecs_id(T))
ecs_id
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component id for EcsDocDescription.
ecs_get_target_for_id
ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t component)
Get the target of a relationship for a given component.

Definition at line 518 of file flecs_c.h.

## ◆ ecs_has

#define ecs_has | ( |  | world,
|  |  | entity,
|  |  | T )

Value:
ecs_has_id(world, entity, ecs_id(T))
ecs_has_id
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity has a component.

Definition at line 496 of file flecs_c.h.

## ◆ ecs_has_pair

#define ecs_has_pair | ( |  | world,
|  |  | entity,
|  |  | first,
|  |  | second )

Value:
ecs_has_id(world, entity, ecs_pair(first, second))

Definition at line 499 of file flecs_c.h.

## ◆ ecs_owns

#define ecs_owns | ( |  | world,
|  |  | entity,
|  |  | T )

Value:
ecs_owns_id(world, entity, ecs_id(T))
ecs_owns_id
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity owns a component.

Definition at line 505 of file flecs_c.h.

## ◆ ecs_owns_pair

#define ecs_owns_pair | ( |  | world,
|  |  | entity,
|  |  | first,
|  |  | second )

Value:
ecs_owns_id(world, entity, ecs_pair(first, second))

Definition at line 502 of file flecs_c.h.

## ◆ ecs_shares

#define ecs_shares | ( |  | world,
|  |  | entity,
|  |  | T )

Value:
(ecs_shares_id(world, entity, ecs_id(T)))

Definition at line 515 of file flecs_c.h.

## ◆ ecs_shares_id

#define ecs_shares_id | ( |  | world,
|  |  | entity,
|  |  | id )

Value:
(ecs_search_relation(world, ecs_get_table(world, entity), 0, ecs_id(id), \
EcsIsA, 1, 0, 0, 0, 0) != -1)
EcsIsA
const ecs_entity_t EcsIsA
Used to express inheritance relationships.
ecs_get_table
ecs_table_t * ecs_get_table(const ecs_world_t *world, ecs_entity_t entity)
Get the table of an entity.
ecs_search_relation
int32_t ecs_search_relation(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t component, ecs_entity_t rel, ecs_flags64_t flags, ecs_entity_t *subject_out, ecs_id_t *component_out, struct ecs_table_record_t **tr_out)
Search for component/relationship id in table type starting from an offset.

Definition at line 508 of file flecs_c.h.

## ◆ ecs_shares_pair

#define ecs_shares_pair | ( |  | world,
|  |  | entity,
|  |  | first,
|  |  | second )

Value:
(ecs_shares_id(world, entity, ecs_pair(first, second)))

Definition at line 512 of file flecs_c.h.