Flecs 2.1 is out!

Flecs Hub

240.000 bouncing boxes rendered with Flecs and Sokol

Improved C++ API

struct Position {
float x;
float y;
};
struct Velocity {
float x;
float y;
};
int main(int argc, char *argv[]) {
flecs::world ecs;
ecs.system<Position, const Velocity>()
.each([](flecs::entity e, Position& p, const Velocity& v) {
p.x += v.x;
p.y += v.y;
});
ecs.entity()
.set<Position>({0, 0})
.set<Velocity>({1, 1});
while (ecs.progress()) { }
}

Faster data structures

State machines

struct Walking { };
struct Running { };
int main(int argc, char *argv[]) {
flecs::world ecs;
auto Movement = ecs.type()
.add<Walking>()
.add<Running>();
auto e = ecs.entity()
.add_switch(Movement)
.add_case<Walking>();
// Remove Walking, add Running
e.add_case<Running>();
}

Subqueries

auto q_parent = ecs.query<Position>();
auto q_sub = ecs.query<Position, Velocity>(q_parent);

Looking ahead…

Alice.add_trait(HasHusband, Bob);

Getting started

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store