Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
Getting & Setting
Collaboration diagram for Getting & Setting:

Macros

#define ecs_set_ptr(world, entity, component, ptr)    ecs_set_id(world, entity, ecs_id(component), sizeof(component), ptr)
 
#define ecs_set(world, entity, component, ...)    ecs_set_id(world, entity, ecs_id(component), sizeof(component), &(component)__VA_ARGS__)
 
#define ecs_set_pair(world, subject, First, second, ...)
 
#define ecs_set_pair_second(world, subject, first, Second, ...)
 
#define ecs_set_pair_object   ecs_set_pair_second
 
#define ecs_set_override(world, entity, T, ...)
 
#define ecs_emplace(world, entity, T)    (ECS_CAST(T*, ecs_emplace_id(world, entity, ecs_id(T))))
 
#define ecs_emplace_pair(world, entity, First, second)    (ECS_CAST(First*, ecs_emplace_id(world, entity, ecs_pair_t(First, second))))
 
#define ecs_get(world, entity, T)    (ECS_CAST(const T*, ecs_get_id(world, entity, ecs_id(T))))
 
#define ecs_get_pair(world, subject, First, second)
 
#define ecs_get_pair_second(world, subject, first, Second)
 
#define ecs_get_pair_object   ecs_get_pair_second
 
#define ecs_record_get(world, record, T)    (ECS_CAST(const T*, ecs_record_get_id(world, record, ecs_id(T))))
 
#define ecs_record_has(world, record, T)    (ecs_record_has_id(world, record, ecs_id(T)))
 
#define ecs_record_get_pair(world, record, First, second)
 
#define ecs_record_get_pair_second(world, record, first, Second)
 
#define ecs_record_get_mut(world, record, T)    (ECS_CAST(T*, ecs_record_get_mut_id(world, record, ecs_id(T))))
 
#define ecs_record_get_mut_pair(world, record, First, second)
 
#define ecs_record_get_mut_pair_second(world, record, first, Second)
 
#define ecs_record_get_mut_pair_object   ecs_record_get_mut_pair_second
 
#define ecs_ref_init(world, entity, T)    ecs_ref_init_id(world, entity, ecs_id(T))
 
#define ecs_ref_get(world, ref, T)    (ECS_CAST(const T*, ecs_ref_get_id(world, ref, ecs_id(T))))
 
#define ecs_get_mut(world, entity, T)    (ECS_CAST(T*, ecs_get_mut_id(world, entity, ecs_id(T))))
 
#define ecs_get_mut_pair(world, subject, First, second)
 
#define ecs_get_mut_pair_second(world, subject, first, Second)
 
#define ecs_get_mut_pair_object   ecs_get_mut_pair_second
 
#define ecs_modified(world, entity, component)    ecs_modified_id(world, entity, ecs_id(component))
 
#define ecs_modified_pair(world, subject, first, second)    ecs_modified_id(world, subject, ecs_pair(first, second))
 

Detailed Description

Macro Definition Documentation

◆ ecs_emplace

#define ecs_emplace ( world,
entity,
T )    (ECS_CAST(T*, ecs_emplace_id(world, entity, ecs_id(T))))

Definition at line 374 of file flecs_c.h.

◆ ecs_emplace_pair

#define ecs_emplace_pair ( world,
entity,
First,
second )    (ECS_CAST(First*, ecs_emplace_id(world, entity, ecs_pair_t(First, second))))

Definition at line 377 of file flecs_c.h.

◆ ecs_get

#define ecs_get ( world,
entity,
T )    (ECS_CAST(const T*, ecs_get_id(world, entity, ecs_id(T))))

Definition at line 380 of file flecs_c.h.

◆ ecs_get_mut

#define ecs_get_mut ( world,
entity,
T )    (ECS_CAST(T*, ecs_get_mut_id(world, entity, ecs_id(T))))

Definition at line 426 of file flecs_c.h.

◆ ecs_get_mut_pair

#define ecs_get_mut_pair ( world,
subject,
First,
second )
Value:
(ECS_CAST(First*, ecs_get_mut_id(world, subject,\
ecs_pair(ecs_id(First), second))))
void * ecs_get_mut_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.

Definition at line 429 of file flecs_c.h.

◆ ecs_get_mut_pair_object

#define ecs_get_mut_pair_object   ecs_get_mut_pair_second

Definition at line 437 of file flecs_c.h.

◆ ecs_get_mut_pair_second

#define ecs_get_mut_pair_second ( world,
subject,
first,
Second )
Value:
(ECS_CAST(Second*, ecs_get_mut_id(world, subject,\
ecs_pair(first, ecs_id(Second)))))

Definition at line 433 of file flecs_c.h.

◆ ecs_get_pair

#define ecs_get_pair ( world,
subject,
First,
second )
Value:
(ECS_CAST(const First*, ecs_get_id(world, subject,\
ecs_pair(ecs_id(First), second))))
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get an immutable pointer to a component.

Definition at line 383 of file flecs_c.h.

◆ ecs_get_pair_object

#define ecs_get_pair_object   ecs_get_pair_second

Definition at line 391 of file flecs_c.h.

◆ ecs_get_pair_second

#define ecs_get_pair_second ( world,
subject,
first,
Second )
Value:
(ECS_CAST(const Second*, ecs_get_id(world, subject,\
ecs_pair(first, ecs_id(Second)))))

Definition at line 387 of file flecs_c.h.

◆ ecs_modified

#define ecs_modified ( world,
entity,
component )    ecs_modified_id(world, entity, ecs_id(component))

Definition at line 439 of file flecs_c.h.

◆ ecs_modified_pair

#define ecs_modified_pair ( world,
subject,
first,
second )    ecs_modified_id(world, subject, ecs_pair(first, second))

Definition at line 442 of file flecs_c.h.

◆ ecs_record_get

#define ecs_record_get ( world,
record,
T )    (ECS_CAST(const T*, ecs_record_get_id(world, record, ecs_id(T))))

Definition at line 393 of file flecs_c.h.

◆ ecs_record_get_mut

#define ecs_record_get_mut ( world,
record,
T )    (ECS_CAST(T*, ecs_record_get_mut_id(world, record, ecs_id(T))))

Definition at line 407 of file flecs_c.h.

◆ ecs_record_get_mut_pair

#define ecs_record_get_mut_pair ( world,
record,
First,
second )
Value:
(ECS_CAST(First*, ecs_record_get_mut_id(world, record, \
ecs_pair(ecs_id(First), second))))
void * ecs_record_get_mut_id(ecs_world_t *world, ecs_record_t *record, ecs_id_t id)
Same as ecs_record_get_id(), but returns a mutable pointer.

Definition at line 410 of file flecs_c.h.

◆ ecs_record_get_mut_pair_object

#define ecs_record_get_mut_pair_object   ecs_record_get_mut_pair_second

Definition at line 418 of file flecs_c.h.

◆ ecs_record_get_mut_pair_second

#define ecs_record_get_mut_pair_second ( world,
record,
first,
Second )
Value:
(ECS_CAST(Second*, ecs_record_get_mut_id(world, record,\
ecs_pair(first, ecs_id(Second)))))

Definition at line 414 of file flecs_c.h.

◆ ecs_record_get_pair

#define ecs_record_get_pair ( world,
record,
First,
second )
Value:
(ECS_CAST(const First*, ecs_record_get_id(world, record, \
ecs_pair(ecs_id(First), second))))
const void * ecs_record_get_id(const ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.

Definition at line 399 of file flecs_c.h.

◆ ecs_record_get_pair_second

#define ecs_record_get_pair_second ( world,
record,
first,
Second )
Value:
(ECS_CAST(const Second*, ecs_record_get_id(world, record,\
ecs_pair(first, ecs_id(Second)))))

Definition at line 403 of file flecs_c.h.

◆ ecs_record_has

#define ecs_record_has ( world,
record,
T )    (ecs_record_has_id(world, record, ecs_id(T)))

Definition at line 396 of file flecs_c.h.

◆ ecs_ref_get

#define ecs_ref_get ( world,
ref,
T )    (ECS_CAST(const T*, ecs_ref_get_id(world, ref, ecs_id(T))))

Definition at line 423 of file flecs_c.h.

◆ ecs_ref_init

#define ecs_ref_init ( world,
entity,
T )    ecs_ref_init_id(world, entity, ecs_id(T))

Definition at line 420 of file flecs_c.h.

◆ ecs_set

#define ecs_set ( world,
entity,
component,
... )    ecs_set_id(world, entity, ecs_id(component), sizeof(component), &(component)__VA_ARGS__)

Definition at line 355 of file flecs_c.h.

◆ ecs_set_override

#define ecs_set_override ( world,
entity,
T,
... )
Value:
ecs_add_id(world, entity, ECS_OVERRIDE | ecs_id(T));\
ecs_set(world, entity, T, __VA_ARGS__)
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
const ecs_id_t ECS_OVERRIDE
Automatically override component when it is inherited.

Definition at line 370 of file flecs_c.h.

◆ ecs_set_pair

#define ecs_set_pair ( world,
subject,
First,
second,
... )
Value:
ecs_set_id(world, subject,\
ecs_pair(ecs_id(First), second),\
sizeof(First), &(First)__VA_ARGS__)
ecs_entity_t ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, size_t size, const void *ptr)
Set the value of a component.

Definition at line 358 of file flecs_c.h.

◆ ecs_set_pair_object

#define ecs_set_pair_object   ecs_set_pair_second

Definition at line 368 of file flecs_c.h.

◆ ecs_set_pair_second

#define ecs_set_pair_second ( world,
subject,
first,
Second,
... )
Value:
ecs_set_id(world, subject,\
ecs_pair(first, ecs_id(Second)),\
sizeof(Second), &(Second)__VA_ARGS__)

Definition at line 363 of file flecs_c.h.

◆ ecs_set_ptr

#define ecs_set_ptr ( world,
entity,
component,
ptr )    ecs_set_id(world, entity, ecs_id(component), sizeof(component), ptr)

Definition at line 352 of file flecs_c.h.