Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
ecs_observer_desc_t Struct Reference

Used with ecs_observer_init(). More...

#include <flecs.h>

Public Attributes

int32_t _canary
 Used for validity testing.
 
ecs_entity_t entity
 Existing entity to associate with an observer (optional).
 
ecs_query_desc_t query
 Query for observer.
 
ecs_entity_t events [8]
 Events to observe (OnAdd, OnRemove, OnSet).
 
bool yield_existing
 When an observer is created, generate events from existing data.
 
bool global_observer
 Global observers are tied to the lifespan of the world.
 
ecs_iter_action_t callback
 Callback to invoke on an event, invoked when the observer matches.
 
ecs_run_action_t run
 Callback invoked on an event.
 
void * ctx
 User context to pass to callback.
 
ecs_ctx_free_t ctx_free
 Callback to free ctx.
 
void * callback_ctx
 Context associated with callback (for language bindings).
 
ecs_ctx_free_t callback_ctx_free
 Callback to free callback ctx.
 
void * run_ctx
 Context associated with run (for language bindings).
 
ecs_ctx_free_t run_ctx_free
 Callback to free run ctx.
 
int32_t * last_event_id
 Used for internal purposes.
 
int8_t term_index_
 Used for internal purposes.
 
ecs_flags32_t flags_
 Used for internal purposes.
 

Detailed Description

Used with ecs_observer_init().

Definition at line 1349 of file flecs.h.

Member Data Documentation

◆ _canary

int32_t ecs_observer_desc_t::_canary

Used for validity testing.

Must be 0.

Definition at line 1351 of file flecs.h.

◆ callback

ecs_iter_action_t ecs_observer_desc_t::callback

Callback to invoke on an event, invoked when the observer matches.

Definition at line 1372 of file flecs.h.

◆ callback_ctx

void* ecs_observer_desc_t::callback_ctx

Context associated with callback (for language bindings).

Definition at line 1389 of file flecs.h.

◆ callback_ctx_free

ecs_ctx_free_t ecs_observer_desc_t::callback_ctx_free

Callback to free callback ctx.

Definition at line 1392 of file flecs.h.

◆ ctx

void* ecs_observer_desc_t::ctx

User context to pass to callback.

Definition at line 1383 of file flecs.h.

◆ ctx_free

ecs_ctx_free_t ecs_observer_desc_t::ctx_free

Callback to free ctx.

Definition at line 1386 of file flecs.h.

◆ entity

ecs_entity_t ecs_observer_desc_t::entity

Existing entity to associate with an observer (optional).

Definition at line 1354 of file flecs.h.

◆ events

ecs_entity_t ecs_observer_desc_t::events[8]

Events to observe (OnAdd, OnRemove, OnSet).

Definition at line 1360 of file flecs.h.

◆ flags_

ecs_flags32_t ecs_observer_desc_t::flags_

Used for internal purposes.

Do not set.

Definition at line 1403 of file flecs.h.

◆ global_observer

bool ecs_observer_desc_t::global_observer

Global observers are tied to the lifespan of the world.

Creating a global observer does not create an entity, and therefore ecs_observer_init() will not return an entity handle.

Definition at line 1369 of file flecs.h.

◆ last_event_id

int32_t* ecs_observer_desc_t::last_event_id

Used for internal purposes.

Do not set.

Definition at line 1401 of file flecs.h.

◆ query

ecs_query_desc_t ecs_observer_desc_t::query

Query for observer.

Definition at line 1357 of file flecs.h.

◆ run

ecs_run_action_t ecs_observer_desc_t::run

Callback invoked on an event.

When left to NULL, the default runner is used, which matches the event with the observer's query, and calls 'callback' when it matches. A reason to override the run function is to improve performance, if there are more efficient ways to test whether an event matches the observer than the general-purpose query matcher.

Definition at line 1380 of file flecs.h.

◆ run_ctx

void* ecs_observer_desc_t::run_ctx

Context associated with run (for language bindings).

Definition at line 1395 of file flecs.h.

◆ run_ctx_free

ecs_ctx_free_t ecs_observer_desc_t::run_ctx_free

Callback to free run ctx.

Definition at line 1398 of file flecs.h.

◆ term_index_

int8_t ecs_observer_desc_t::term_index_

Used for internal purposes.

Do not set.

Definition at line 1402 of file flecs.h.

◆ yield_existing

bool ecs_observer_desc_t::yield_existing

When an observer is created, generate events from existing data.

For example, EcsOnAdd Position would match all existing instances of Position.

Definition at line 1364 of file flecs.h.


The documentation for this struct was generated from the following file: