Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
builder.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace flecs {
9
17 script_builder(flecs::world_t *world, const char *name = nullptr)
18 : world_(world)
19 , desc_{}
20 {
21 if (name != nullptr) {
22 ecs_entity_desc_t entity_desc = {};
23 entity_desc.name = name;
24 entity_desc.sep = "::";
25 entity_desc.root_sep = "::";
26 this->desc_.entity = ecs_entity_init(world, &entity_desc);
27 }
28 }
29
30 script_builder& code(const char *str) {
31 desc_.code = str;
32 return *this;
33 }
34
35 script_builder& filename(const char *str) {
36 desc_.filename = str;
37 return *this;
38 }
39
40 flecs::entity run() const;
41
42protected:
43 flecs::world_t *world_;
45};
46
47}
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
Used with ecs_entity_init().
Definition flecs.h:938
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:950
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:954
const char * name
Name of the entity.
Definition flecs.h:945
Used with ecs_script_init()
Definition script.h:177
Entity.
Definition entity.hpp:30
Script builder interface.
Definition builder.hpp:16
The world.
Definition world.hpp:137