flecs-hub / explorer

Web-based UI for monitoring Flecs applications, trying out queries & learning ECS
MIT License
64 stars 14 forks source link

The "C++ API" tab presents the wrong syntax for optional entries (missing pointer) #35

Open Gaspard-- opened 2 months ago

Gaspard-- commented 2 months ago

When going on the queries page, and using a query like:

?Offset($this)

And then looking at the C++ API tag, the suggested code looks like the following:

Declaration:

flecs::query<Offset> q;

Creation:

q = world.query_builder<Offset>()
  .term_at(0).optional()
  .build();

Iteration

q.each([](flecs::entity e, Offset&) {

});

In all of the C++ code above, offset should be a pointer Offset *.

SanderMertens commented 2 months ago

Nice catch! I'll look into it.