Data definition format for loading entity data.
More...
|
FLECS_API | ECS_COMPONENT_DECLARE (EcsScript) |
|
FLECS_API int | ecs_plecs_from_str (ecs_world_t *world, const char *name, const char *str) |
| Parse plecs string. More...
|
|
FLECS_API int | ecs_plecs_from_file (ecs_world_t *world, const char *filename) |
| Parse plecs file. More...
|
|
FLECS_API ecs_entity_t | ecs_script_init (ecs_world_t *world, const ecs_script_desc_t *desc) |
| Load managed script. More...
|
|
FLECS_API int | ecs_script_update (ecs_world_t *world, ecs_entity_t script, ecs_entity_t instance, const char *str, ecs_vars_t *vars) |
| Update script with new code. More...
|
|
FLECS_API void | ecs_script_clear (ecs_world_t *world, ecs_entity_t script, ecs_entity_t instance) |
| Clear all entities associated with script. More...
|
|
FLECS_API void | FlecsScriptImport (ecs_world_t *world) |
|
Data definition format for loading entity data.
◆ ecs_script
◆ FLECS_PLECS_H
◆ ecs_plecs_from_file()
FLECS_API int ecs_plecs_from_file |
( |
ecs_world_t * |
world, |
|
|
const char * |
filename |
|
) |
| |
Parse plecs file.
This parses a plecs file and instantiates the entities in the world. This operation is equivalent to loading the file contents and passing it to ecs_plecs_from_str.
- Parameters
-
world | The world. |
filename | The plecs file name. |
- Returns
- Zero if success, non-zero otherwise.
◆ ecs_plecs_from_str()
FLECS_API int ecs_plecs_from_str |
( |
ecs_world_t * |
world, |
|
|
const char * |
name, |
|
|
const char * |
str |
|
) |
| |
Parse plecs string.
This parses a plecs string and instantiates the entities in the world.
- Parameters
-
world | The world. |
name | The script name (typically the file). |
str | The plecs string. |
- Returns
- Zero if success, non-zero otherwise.
◆ ecs_script_clear()
Clear all entities associated with script.
- Parameters
-
world | The world. |
script | The script entity. |
instance | The script instance. |
◆ ecs_script_init()
Load managed script.
A managed script tracks which entities it creates, and keeps those entities synchronized when the contents of the script are updated. When the script is updated, entities that are no longer in the new version will be deleted.
This feature is experimental.
- Parameters
-
world | The world. |
desc | Script descriptor. |
◆ ecs_script_update()
Update script with new code.
- Parameters
-
world | The world. |
script | The script entity. |
instance | An assembly instance (optional). |
str | The script code. |
vars | Optional preset variables for script parameterization. |