| Top |
| void | leecs_template_new () |
| #define | leecs_template_add_component() |
| #define | leecs_template_add_tag() |
| #define | leecs_template_has_component() |
An entity template is a named set of components and values for those components. Templates are used to create entities with a pre-defined composition.
Creating templates is similar to creating entities. Create a new template
with leecs_template_new() and then add components to the template using
leecs_template_add_component() and leecs_template_add_tag(). Then any number
of entities can be created using leecs_entity_new_from_template() and they
will have the same components with the same values which were added to the
template.
Additional components can be added to and removed from entities created from a template, but the components from the template cannot be removed.
void leecs_template_new (LeecsRegistry *registry,const char *name);
Creates a new empty entity template in registry
.
registry |
LeecsRegistry to register the template in. |
|
name |
Name of the template as a string literal. |
#define leecs_template_add_component(registry, template, component_t, ...)
Adds component_t
to the given template. When an entity is created from the
template, component_t
will be initialized using the given initializer list.
registry |
LeecsRegistry the template is stored in. |
|
template |
Name of the template. |
|
component_t |
The type of the component. |
|
... |
Default initializer list for |
#define leecs_template_add_tag(registry, template, tag)
Adds tag
to the given template.
registry |
LeecsRegistry the template is stored in. |
|
template |
Name of the template. |
|
tag |
The symbol of the tag. |
#define leecs_template_has_component(registry, template, component)
Checks whether the given template has component
.
registry |
LeecsRegistry the template is stored in. |
|
template |
Name of the template. |
|
component |
The symbol of the component. |