Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
Component API
Collaboration diagram for Component API:

Macros

#define ecs_set_hooks(world, T, ...)
 Set component hooks.
#define ecs_get_hooks(world, T)
 Get component hooks.
#define ECS_CTOR(type, var, ...)
 Declare a constructor.
#define ECS_DTOR(type, var, ...)
 Declare a destructor.
#define ECS_COPY(type, dst_var, src_var, ...)
 Declare a copy action.
#define ECS_MOVE(type, dst_var, src_var, ...)
 Declare a move action.
#define ECS_ON_ADD(type, ptr, ...)
 Declare an on_add hook.
#define ECS_ON_REMOVE(type, ptr, ...)
 Declare an on_remove hook.
#define ECS_ON_SET(type, ptr, ...)
 Declare an on_set hook.
#define ecs_ctor(type)
 Map from typename to constructor function name.
#define ecs_dtor(type)
 Map from typename to destructor function name.
#define ecs_copy(type)
 Map from typename to copy function name.
#define ecs_move(type)
 Map from typename to move function name.
#define ecs_on_set(type)
 Map from typename to on_set function name.
#define ecs_on_add(type)
 Map from typename to on_add function name.
#define ecs_on_remove(type)
 Map from typename to on_remove function name.

Detailed Description

Macro Definition Documentation

◆ ECS_COPY

#define ECS_COPY ( type,
dst_var,
src_var,
... )
Value:
ECS_COPY_IMPL(type, dst_var, src_var, __VA_ARGS__)

Declare a copy action.

Example:

ECS_COPY(MyType, dst, src, { dst->value = strdup(src->value); });
#define ECS_COPY(type, dst_var, src_var,...)
Declare a copy action.
Definition flecs_c.h:664

Definition at line 664 of file flecs_c.h.

◆ ecs_copy

#define ecs_copy ( type)
Value:
type##_copy

Map from typename to copy function name.

Definition at line 698 of file flecs_c.h.

◆ ECS_CTOR

#define ECS_CTOR ( type,
var,
... )
Value:
ECS_XTOR_IMPL(type, ctor, var, __VA_ARGS__)

Declare a constructor.

Example:

ECS_CTOR(MyType, ptr, { ptr->value = NULL; });
#define ECS_CTOR(type, var,...)
Declare a constructor.
Definition flecs_c.h:644

Definition at line 644 of file flecs_c.h.

◆ ecs_ctor

#define ecs_ctor ( type)
Value:
type##_ctor

Map from typename to constructor function name.

Definition at line 694 of file flecs_c.h.

◆ ECS_DTOR

#define ECS_DTOR ( type,
var,
... )
Value:
ECS_XTOR_IMPL(type, dtor, var, __VA_ARGS__)

Declare a destructor.

Example:

ECS_DTOR(MyType, ptr, { free(ptr->value); });
#define ECS_DTOR(type, var,...)
Declare a destructor.
Definition flecs_c.h:654

Definition at line 654 of file flecs_c.h.

◆ ecs_dtor

#define ecs_dtor ( type)
Value:
type##_dtor

Map from typename to destructor function name.

Definition at line 696 of file flecs_c.h.

◆ ecs_get_hooks

#define ecs_get_hooks ( world,
T )
Value:
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component ID for EcsDocDescription.
const ecs_type_hooks_t * ecs_get_hooks_id(const ecs_world_t *world, ecs_entity_t component)
Get hooks for a component.

Get component hooks.

Definition at line 634 of file flecs_c.h.

◆ ECS_MOVE

#define ECS_MOVE ( type,
dst_var,
src_var,
... )
Value:
ECS_MOVE_IMPL(type, dst_var, src_var, __VA_ARGS__)

Declare a move action.

Example:

ECS_MOVE(MyType, dst, src, { dst->value = src->value; src->value = 0; });
#define ECS_MOVE(type, dst_var, src_var,...)
Declare a move action.
Definition flecs_c.h:674

Definition at line 674 of file flecs_c.h.

◆ ecs_move

#define ecs_move ( type)
Value:
type##_move

Map from typename to move function name.

Definition at line 700 of file flecs_c.h.

◆ ECS_ON_ADD

#define ECS_ON_ADD ( type,
ptr,
... )
Value:
ECS_HOOK_IMPL(type, ecs_on_add(type), ptr, __VA_ARGS__)
#define ecs_on_add(type)
Map from typename to on_add function name.
Definition flecs_c.h:704

Declare an on_add hook.

Example:

ECS_ON_ADD(MyType, ptr, { printf("added\n"); });
#define ECS_ON_ADD(type, ptr,...)
Declare an on_add hook.
Definition flecs_c.h:684

Definition at line 684 of file flecs_c.h.

◆ ecs_on_add

#define ecs_on_add ( type)
Value:
type##_on_add

Map from typename to on_add function name.

Definition at line 704 of file flecs_c.h.

◆ ECS_ON_REMOVE

#define ECS_ON_REMOVE ( type,
ptr,
... )
Value:
ECS_HOOK_IMPL(type, ecs_on_remove(type), ptr, __VA_ARGS__)
#define ecs_on_remove(type)
Map from typename to on_remove function name.
Definition flecs_c.h:706

Declare an on_remove hook.

Definition at line 687 of file flecs_c.h.

◆ ecs_on_remove

#define ecs_on_remove ( type)
Value:
type##_on_remove

Map from typename to on_remove function name.

Definition at line 706 of file flecs_c.h.

◆ ECS_ON_SET

#define ECS_ON_SET ( type,
ptr,
... )
Value:
ECS_HOOK_IMPL(type, ecs_on_set(type), ptr, __VA_ARGS__)
#define ecs_on_set(type)
Map from typename to on_set function name.
Definition flecs_c.h:702

Declare an on_set hook.

Definition at line 690 of file flecs_c.h.

◆ ecs_on_set

#define ecs_on_set ( type)
Value:
type##_on_set

Map from typename to on_set function name.

Definition at line 702 of file flecs_c.h.

◆ ecs_set_hooks

#define ecs_set_hooks ( world,
T,
... )
Value:
ecs_set_hooks_id(world, ecs_id(T), &(ecs_type_hooks_t)__VA_ARGS__)
void ecs_set_hooks_id(ecs_world_t *world, ecs_entity_t component, const ecs_type_hooks_t *hooks)
Register hooks for a component.

Set component hooks.

Definition at line 630 of file flecs_c.h.