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,30 @@
#include <find_entity.h>
#include <iostream>
struct Position {
int x, y;
};
int main() {
flecs::world ecs;
ecs.entity("e1").set<Position>({10, 20});
ecs.entity("e2").set<Position>({20, 30});
// Create a simple query for component Position
flecs::query<Position> q = ecs.query<Position>();
// Find the entity for which Position.x is 20
flecs::entity e = q.find([](Position& p) {
return p.x == 20;
});
if (e) {
std::cout << "Found entity " << e.path() << std::endl;
} else {
std::cout << "No entity found" << std::endl;
}
// Output
// Found entity ::e2
}