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_get_mut(world, entity, T)    (ECS_CAST(T*, ecs_get_mut_id(world, entity, 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_ensure(world, entity, T)    (ECS_CAST(T*, ecs_ensure_id(world, entity, ecs_id(T))))
 
#define ecs_ensure(world, entity, T)    (ECS_CAST(T*, ecs_ensure_id(world, entity, ecs_id(T))))
 
#define ecs_ensure_pair(world, subject, First, second)
 
#define ecs_ensure_pair(world, subject, First, second)
 
#define ecs_ensure_pair_second(world, subject, first, Second)
 
#define ecs_ensure_pair_second(world, subject, first, Second)
 
#define ecs_ensure_pair_object   ecs_ensure_pair_second
 
#define ecs_ensure_pair_object   ecs_ensure_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))
 
#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_ensure(world, record, T)    (ECS_CAST(T*, ecs_record_ensure_id(world, record, ecs_id(T))))
 
#define ecs_record_ensure_pair(world, record, First, second)
 
#define ecs_record_ensure_pair_second(world, record, first, Second)
 
#define ecs_record_ensure_pair_object   ecs_record_ensure_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))))
 

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 378 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 381 of file flecs_c.h.

◆ ecs_ensure [1/2]

#define ecs_ensure ( world,
entity,
T )    (ECS_CAST(T*, ecs_ensure_id(world, entity, ecs_id(T))))

Definition at line 419 of file flecs_c.h.

◆ ecs_ensure [2/2]

#define ecs_ensure ( world,
entity,
T )    (ECS_CAST(T*, ecs_ensure_id(world, entity, ecs_id(T))))

Definition at line 419 of file flecs_c.h.

◆ ecs_ensure_pair [1/2]

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

Definition at line 422 of file flecs_c.h.

◆ ecs_ensure_pair [2/2]

#define ecs_ensure_pair ( world,
subject,
First,
second )
Value:
(ECS_CAST(First*, ecs_ensure_id(world, subject,\
ecs_pair(ecs_id(First), second))))

Definition at line 422 of file flecs_c.h.

◆ ecs_ensure_pair_object [1/2]

#define ecs_ensure_pair_object   ecs_ensure_pair_second

Definition at line 430 of file flecs_c.h.

◆ ecs_ensure_pair_object [2/2]

#define ecs_ensure_pair_object   ecs_ensure_pair_second

Definition at line 430 of file flecs_c.h.

◆ ecs_ensure_pair_second [1/2]

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

Definition at line 426 of file flecs_c.h.

◆ ecs_ensure_pair_second [2/2]

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

Definition at line 426 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 386 of file flecs_c.h.

◆ ecs_get_mut [1/2]

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

Definition at line 401 of file flecs_c.h.

◆ ecs_get_mut [2/2]

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

Definition at line 401 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(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.

Definition at line 404 of file flecs_c.h.

◆ ecs_get_mut_pair_object

#define ecs_get_mut_pair_object   ecs_get_mut_pair_second

Definition at line 412 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 408 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 389 of file flecs_c.h.

◆ ecs_get_pair_object

#define ecs_get_pair_object   ecs_get_pair_second

Definition at line 397 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 393 of file flecs_c.h.

◆ ecs_modified

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

Definition at line 447 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 450 of file flecs_c.h.

◆ ecs_record_ensure

#define ecs_record_ensure ( world,
record,
T )    (ECS_CAST(T*, ecs_record_ensure_id(world, record, ecs_id(T))))

Definition at line 469 of file flecs_c.h.

◆ ecs_record_ensure_pair

#define ecs_record_ensure_pair ( world,
record,
First,
second )
Value:
(ECS_CAST(First*, ecs_record_ensure_id(world, record, \
ecs_pair(ecs_id(First), second))))
void * ecs_record_ensure_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 472 of file flecs_c.h.

◆ ecs_record_ensure_pair_object

#define ecs_record_ensure_pair_object   ecs_record_ensure_pair_second

Definition at line 480 of file flecs_c.h.

◆ ecs_record_ensure_pair_second

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

Definition at line 476 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 455 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 461 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 465 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 458 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 485 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 482 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 357 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 372 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 360 of file flecs_c.h.

◆ ecs_set_pair_object

#define ecs_set_pair_object   ecs_set_pair_second

Definition at line 370 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 365 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 354 of file flecs_c.h.