1#include <multi_set_get.h>
2#include <iostream>
3
4
5
6struct Position {
7 double x, y;
8};
9
10struct Mass {
11 double value;
12};
13
14int main(int, char *[]) {
16
17
19 .
insert([](Position& p, Mass& m) {
20 p.x = 10;
21 p.y = 20;
22 m.value = 100;
23 });
24
25
26 bool found = e.get([](const Position& p, const Mass& m) {
27 std::cout << "Position: {" << p.x << ", " << p.y << "}\n"
28 << "Mass: {" << m.value << "}\n";
29 });
30
31 std::cout << "Components found: " << (found ? "true" : "false") << "\n";
32
33
34
35
36
37
38 return 0;
39}
flecs::entity entity(Args &&... args) const
Create an entity.
const Self & insert(const Func &func) const
Set 1..N components.