Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
Component API

Macros

#define ecs_set_hooks(world, T, ...)    ecs_set_hooks_id(world, ecs_id(T), &(ecs_type_hooks_t)__VA_ARGS__)
 
#define ecs_get_hooks(world, T)    ecs_get_hooks_id(world, ecs_id(T));
 
#define ECS_CTOR(type, var, ...)    ECS_XTOR_IMPL(type, ctor, var, __VA_ARGS__)
 Declare a constructor.
 
#define ECS_DTOR(type, var, ...)    ECS_XTOR_IMPL(type, dtor, var, __VA_ARGS__)
 Declare a destructor.
 
#define ECS_COPY(type, dst_var, src_var, ...)    ECS_COPY_IMPL(type, dst_var, src_var, __VA_ARGS__)
 Declare a copy action.
 
#define ECS_MOVE(type, dst_var, src_var, ...)    ECS_MOVE_IMPL(type, dst_var, src_var, __VA_ARGS__)
 Declare a move action.
 
#define ECS_ON_ADD(type, ptr, ...)    ECS_HOOK_IMPL(type, ecs_on_add(type), ptr, __VA_ARGS__)
 Declare component hooks.
 
#define ECS_ON_REMOVE(type, ptr, ...)    ECS_HOOK_IMPL(type, ecs_on_remove(type), ptr, __VA_ARGS__)
 
#define ECS_ON_SET(type, ptr, ...)    ECS_HOOK_IMPL(type, ecs_on_set(type), ptr, __VA_ARGS__)
 
#define ecs_ctor(type)   type##_ctor
 
#define ecs_dtor(type)   type##_dtor
 
#define ecs_copy(type)   type##_copy
 
#define ecs_move(type)   type##_move
 
#define ecs_on_set(type)   type##_on_set
 
#define ecs_on_add(type)   type##_on_add
 
#define ecs_on_remove(type)   type##_on_remove
 

Detailed Description

Macro Definition Documentation

◆ ecs_copy

#define ecs_copy (   type)    type##_copy

Definition at line 562 of file flecs_c.h.

◆ ECS_COPY

#define ECS_COPY (   type,
  dst_var,
  src_var,
  ... 
)     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); });

Definition at line 538 of file flecs_c.h.

◆ ecs_ctor

#define ecs_ctor (   type)    type##_ctor

Definition at line 560 of file flecs_c.h.

◆ ECS_CTOR

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

Declare a constructor.

Example: ECS_CTOR(MyType, ptr, { ptr->value = NULL; });

Definition at line 524 of file flecs_c.h.

◆ ecs_dtor

#define ecs_dtor (   type)    type##_dtor

Definition at line 561 of file flecs_c.h.

◆ ECS_DTOR

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

Declare a destructor.

Example: ECS_DTOR(MyType, ptr, { free(ptr->value); });

Definition at line 531 of file flecs_c.h.

◆ ecs_get_hooks

#define ecs_get_hooks (   world,
 
)     ecs_get_hooks_id(world, ecs_id(T));

Definition at line 517 of file flecs_c.h.

◆ ecs_move

#define ecs_move (   type)    type##_move

Definition at line 563 of file flecs_c.h.

◆ ECS_MOVE

#define ECS_MOVE (   type,
  dst_var,
  src_var,
  ... 
)     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; });

Definition at line 545 of file flecs_c.h.

◆ ecs_on_add

#define ecs_on_add (   type)    type##_on_add

Definition at line 565 of file flecs_c.h.

◆ ECS_ON_ADD

#define ECS_ON_ADD (   type,
  ptr,
  ... 
)     ECS_HOOK_IMPL(type, ecs_on_add(type), ptr, __VA_ARGS__)

Declare component hooks.

Example: ECS_ON_SET(MyType, ptr, { printf("%d\n", ptr->value); });

Definition at line 552 of file flecs_c.h.

◆ ecs_on_remove

#define ecs_on_remove (   type)    type##_on_remove

Definition at line 566 of file flecs_c.h.

◆ ECS_ON_REMOVE

#define ECS_ON_REMOVE (   type,
  ptr,
  ... 
)     ECS_HOOK_IMPL(type, ecs_on_remove(type), ptr, __VA_ARGS__)

Definition at line 554 of file flecs_c.h.

◆ ecs_on_set

#define ecs_on_set (   type)    type##_on_set

Definition at line 564 of file flecs_c.h.

◆ ECS_ON_SET

#define ECS_ON_SET (   type,
  ptr,
  ... 
)     ECS_HOOK_IMPL(type, ecs_on_set(type), ptr, __VA_ARGS__)

Definition at line 556 of file flecs_c.h.

◆ ecs_set_hooks

#define ecs_set_hooks (   world,
  T,
  ... 
)     ecs_set_hooks_id(world, ecs_id(T), &(ecs_type_hooks_t)__VA_ARGS__)

Definition at line 514 of file flecs_c.h.