1#include <enum_relations.h>
2#include <stdio.h>
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19enum Tile {
20 Grass,
21 Sand,
22 Stone
23};
24
25
26enum class TileStatus {
27 Free,
28 Occupied,
29};
30
31int main(int, char *[]) {
33
34
36 .add(Tile::Stone)
37 .add(TileStatus::Free);
38
39
41
42
43 tile.add(TileStatus::Occupied);
44
45
47
48
49 printf("%s\n", tile.has<Tile>() ? "true" : "false");
50 printf("%s\n", tile.has(Tile::Stone) ? "true" : "false");
51
52
54 printf("%s\n", (v == Tile::Stone) ? "true" : "false");
55
56
57 ecs.
entity().add(Tile::Grass).add(TileStatus::Free);
58 ecs.
entity().add(Tile::Sand).add(TileStatus::Occupied);
59
60
62 .with<Tile>(flecs::Wildcard)
63 .build()
66 printf(
"%s\n", tile_constant.
path().
c_str());
67 });
68
69
70
71
72
73
74
76 .with<Tile>(flecs::Wildcard)
77 .with(TileStatus::Occupied)
78 .build()
81 printf(
"%s\n", tile_constant.
path().
c_str());
82 });
83
84
85
86
87
88
89 tile.remove<TileStatus>(flecs::Wildcard);
90}
flecs::query_builder< Comps... > query_builder(Args &&... args) const
Create a query builder.
flecs::entity entity(Args &&... args) const
Create an entity.
flecs::type type() const
Get the entity's type.
flecs::string path(const char *sep="::", const char *init_sep="::") const
Return the entity path.
Enum get_constant() const
Get enum constant for enum relationship.
flecs::entity second() const
Get second element from a pair.
Class for iterating over query results.
flecs::id pair(int8_t index) const
Obtain the pair ID matched for the field.
const char * c_str() const
Return the C string.
flecs::string str() const
Convert the type to a comma-separated string.