Function ecs_query_changed

Synopsis

#include <include/flecs.h>

FLECS_API bool ecs_query_changed(ecs_query_t *query, const ecs_iter_t *it)

Description

Returns whether the query data changed since the last iteration. The operation will return true after:

  • new entities have been matched with
  • new tables have been matched/unmatched with
  • matched entities were deleted
  • matched components were changed

The operation will not return true after a write-only (EcsOut) or filter (EcsInOutNone) term has changed, when a term is not matched with the current table (This subject) or for tag terms.

The changed state of a table is reset after it is iterated. If a iterator was not iterated until completion, tables may still be marked as changed.

If no iterator is provided the operation will return the changed state of the all matched tables of the query.

If an iterator is provided, the operation will return the changed state of the currently returned iterator result. The following preconditions must be met before using an iterator with change detection:

  • The iterator is a query iterator (created with ecs_query_iter)
  • The iterator must be valid (ecs_query_next must have returned true)
  • The iterator must be instanced
Parameters

query - The query (optional if 'it' is provided).

it - The iterator result to test (optional if 'query' is provided).

Returns
true if entities changed, otherwise false.

Mentioned in

Source

Line 3407 in include/flecs.h.