1#include <with.h>
2#include <iostream>
3
4struct Position {
5 double x, y;
6};
7
8struct Npc { };
9
10int main(int, char *[]) {
12
13
14
15
16
17
19 .with<Npc>()
20 .build();
21
22
24 .set<Position>({10, 20})
25 .add<Npc>();
26
28 .set<Position>({10, 20})
29 .add<Npc>();
30
31
33 .set<Position>({10, 20});
34
35
36
38 std::cout << e.
name() <<
": {" << p.x <<
", " << p.y <<
"}\n";
39 });
40
41
42
43
44}
flecs::query_builder< Comps... > query_builder(Args &&... args) const
Create a query builder.
flecs::entity entity(Args &&... args) const
Create an entity.
flecs::string_view name() const
Return the entity name.
void each(Func &&func) const
Each iterator.