#include <include/flecs.h> FLECS_API void ecs_query_group_by(ecs_world_t *world, ecs_query_t *query, ecs_entity_t component, ecs_rank_type_action_t rank_action)
Group and sort matched tables. Similar yo ecs_query_order_by, but instead of sorting individual entities, this operation only sorts matched tables. This can be useful of a query needs to enforce a certain iteration order upon the tables it is iterating, for example by giving a certain component or tag a higher priority.
The sorting function assigns a "rank" to each type, which is then used to sort the tables. Tables with higher ranks will appear later in the iteration.
Resorting happens when a query iterator is obtained, and only if the set of matched tables for a query has changed. If table sorting is enabled together with entity sorting, table sorting takes precedence, and entities will be sorted within each set of tables that are assigned the same rank.
world- The world.
query- The query.
component- The component used to determine the group rank.
rank_action- The rank action.