1#include <run_to_each_callback.h>
2#include <iostream>
3
4
5
6
7
8struct Position {
9 double x, y;
10};
11
12struct Velocity {
13 double x, y;
14};
15
16int main(int, char *[]) {
18
20
22 std::cout << "Move begin\n";
23
24
27 }
28
29 std::cout << "Move end\n";
30 },
32 p.x += v.x;
33 p.y += v.y;
34 std::cout << e.
name() <<
": {" << p.x <<
", " << p.y <<
"}\n";
35 });
36
37
39 .set<Position>({10, 20})
40 .set<Velocity>({1, 2});
41
43 .set<Position>({10, 20})
44 .set<Velocity>({3, 4});
45
46
48 .set<Position>({10, 20});
49
50
52
53
54
55
56
57
58}
flecs::system system(flecs::entity e) const
Upcast an entity to a system.
flecs::entity entity(Args &&... args) const
Create an entity.
flecs::string_view name() const
Return the entity name.
Class for iterating over query results.
void each()
Forward to each().
bool next()
Progress iterator.
system & run(Func &&func)
Replace the system's run callback.