Skip to content

Commit edb2bc7

Browse files
authored
Update entity.hpp to support different separator types in cpp
1 parent 2fcb2f6 commit edb2bc7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

include/flecs/addons/cpp/entity.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,29 @@ struct entity : entity_builder<entity>
7777
id_ = ecs_entity_init(world, &desc);
7878
}
7979

80+
/** Create a named entity.
81+
* Named entities can be looked up with the lookup functions. Entity names
82+
* may be scoped, where each element in the name is separated by sep.
83+
* For example: "Foo.Bar". If parts of the hierarchy in the scoped name do
84+
* not yet exist, they will be automatically created.
85+
*
86+
* @param world The world in which to create the entity.
87+
* @param name The entity name.
88+
* @param sep The separator to use for the scoped name.
89+
* @param root_sep The separator to use for the root of the scoped name.
90+
*/
91+
explicit entity(world_t *world, const char *name, const char *sep, const char *root_sep)
92+
: entity_builder()
93+
{
94+
world_ = world;
95+
96+
ecs_entity_desc_t desc = {};
97+
desc.name = name;
98+
desc.sep = sep;
99+
desc.root_sep = root_sep;
100+
id_ = ecs_entity_init(world, &desc);
101+
}
102+
80103
/** Conversion from flecs::entity_t to flecs::entity.
81104
*
82105
* @param id The entity_t value to convert.

0 commit comments

Comments
 (0)