Function ecs_filter_init

Synopsis

#include <include/flecs.h>

FLECS_API ecs_filter_t * ecs_filter_init(const ecs_world_t *world, const ecs_filter_desc_t *desc)

Description

Initialize filter A filter is a lightweight object that can be used to query for entities in a world. Filters, as opposed to queries, do not cache results. They are therefore slower to iterate, but are faster to create.

When a filter is copied by value, make sure to use "ecs_filter_move" to ensure that the terms pointer still points to the inline array:

ecs_filter_move(&dst_filter, &src_filter)

Alternatively, the ecs_filter_move function can be called with both arguments set to the same filter, to ensure the pointer is valid:

ecs_filter_move(&f, &f)

It is possible to create a filter without allocating any memory, by setting the .storage member in ecs_filter_desc_t. See the documentation for the member for more details.

Parameters

world - The world.

desc - Properties for the filter to create.

Returns
The filter if successful, NULL if not successful.

Mentioned in

Source

Line 3111 in include/flecs.h.