#include #include #include #include #include "flecs.h" #include "graph_module.h" struct graph_module { graph_module(flecs::world &ecs) { // ecs.module(); flecs::entity s = ecs.system("ZoneArea2") .kind(0) .without() .write() .each([](flecs::iter &it, size_t count, WorldEditor::components::buildings_layout_zone &f) { flecs::entity zone_e = it.entity(count); printf("running...2\n"); zone_e.set< WorldEditor::components::buildings_layout_area>( { 0.0f }); }); ecs.system("Zone2") .kind(flecs::OnUpdate) .each([](flecs::iter &it, size_t count, WorldEditor::components::buildings_layout_zone &f) { flecs::entity zone_e = it.entity(count); flecs::world w = zone_e.world(); flecs::entity se = w.lookup("::graph_module::ZoneArea2"); assert(se.is_valid()); w.system(se).run(); }); } }; int main() { flecs::world ecs; ecs.import (); printf("1\n"); flecs::entity e0 = ecs.entity("base"); flecs::entity e1 = ecs.entity("zone1").child_of(e0); printf("2\n"); e1.set({0, false}); flecs::entity e2 = ecs.entity("zone2").child_of(e0); printf("3\n"); e2.set({1, true}); printf("4\n"); while (1) ecs.progress(); printf("5\n"); return 0; }