1#include <world_query.h>
2#include <iostream>
3
4struct Position {
5 double x, y;
6};
7
8struct Velocity {
9 double x, y;
10};
11
12int main(int, char *[]) {
14
15
17 .set<Position>({10, 20})
18 .set<Velocity>({1, 2});
19
21 .set<Position>({10, 20})
22 .set<Velocity>({3, 4});
23
24
26 .set<Position>({10, 20});
27
28
30 p.x += v.x;
31 p.y += v.y;
32 std::cout << e.
name() <<
": {" << p.x <<
", " << p.y <<
"}\n";
33 });
34}
void each(Func &&func) const
Iterate over all entities with components in the argument list of the function.
flecs::entity entity(Args &&... args) const
Create an entity.
flecs::string_view name() const
Return the entity name.