Function ecs_filter_init

Synopsis

#include <include/flecs.h>

FLECS_API int ecs_filter_init(const ecs_world_t *world, ecs_filter_t *filter_out, 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.

This operation will at minimum allocate an array to hold the filter terms in the returned filter struct. It may allocate additional memory if the provided description contains a name, expression, or if the provided array of terms contains strings (identifier names or term names).

It is possible to create a filter without allocating any memory, by setting the "terms" and "term_count" members directly. When doing so an application should not call ecs_filter_init but ecs_filter_finalize. This will ensure that all fields are consistent and properly filled out.

Parameters

world - The world.

desc - Properties for the filter to create.

filter_out - The filter.

Returns
Zero if successful, non-zero if failed.

Mentioned in

Source

Line 2495 in include/flecs.h.