Properly link flecs library

This commit is contained in:
2023-11-09 11:38:29 +01:00
parent dc585396c3
commit 8edcf9305c
1392 changed files with 390081 additions and 164 deletions

View File

@@ -0,0 +1,33 @@
#include <basics_enum.h>
#include <iostream>
enum Color {
Red,
Green,
Blue
};
struct TypeWithEnum {
Color color;
};
int main(int, char *[]) {
flecs::world ecs;
// Register components with reflection data
ecs.component<Color>()
.constant("Red", Red)
.constant("Green", Green)
.constant("Blue", Blue);
ecs.component<TypeWithEnum>()
.member<Color>("color");
// Create entity with Position as usual
flecs::entity e = ecs.entity()
.set<TypeWithEnum>({Green});
// Convert position component to flecs expression string
const TypeWithEnum *ptr = e.get<TypeWithEnum>();
std::cout << ecs.to_expr(ptr).c_str() << "\n"; // {color: Green}
}