Flecs v3.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
 
ecs_entity_t entity
 Existing entity to associate with observer (optional) More...
 
ecs_filter_desc_t filter
 Filter for observer. More...
 
ecs_entity_t events [(8)]
 Events to observe (OnAdd, OnRemove, OnSet, UnSet) More...
 
bool yield_existing
 When observer is created, generate events from existing data. More...
 
ecs_iter_action_t callback
 Callback to invoke on an event, invoked when the observer matches. More...
 
ecs_run_action_t run
 Callback invoked on an event. More...
 
void * ctx
 User context to pass to callback. More...
 
void * binding_ctx
 Context to be used for language bindings. More...
 
ecs_ctx_free_t ctx_free
 Callback to free ctx. More...
 
ecs_ctx_free_t binding_ctx_free
 Callback to free binding_ctx. More...
 
ecs_poly_tobservable
 Observable with which to register the observer. More...
 
int32_t * last_event_id
 Optional shared last event id for multiple observers. More...
 
int32_t term_index
 Used for internal purposes. More...
 

Detailed Description

Used with ecs_observer_init.

Definition at line 864 of file flecs.h.

Member Data Documentation

◆ _canary

int32_t ecs_observer_desc_t::_canary

Definition at line 865 of file flecs.h.

◆ binding_ctx

void* ecs_observer_desc_t::binding_ctx

Context to be used for language bindings.

Definition at line 896 of file flecs.h.

◆ binding_ctx_free

ecs_ctx_free_t ecs_observer_desc_t::binding_ctx_free

Callback to free binding_ctx.

Definition at line 902 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 882 of file flecs.h.

◆ ctx

void* ecs_observer_desc_t::ctx

User context to pass to callback.

Definition at line 893 of file flecs.h.

◆ ctx_free

ecs_ctx_free_t ecs_observer_desc_t::ctx_free

Callback to free ctx.

Definition at line 899 of file flecs.h.

◆ entity

ecs_entity_t ecs_observer_desc_t::entity

Existing entity to associate with observer (optional)

Definition at line 868 of file flecs.h.

◆ events

ecs_entity_t ecs_observer_desc_t::events[(8)]

Events to observe (OnAdd, OnRemove, OnSet, UnSet)

Definition at line 874 of file flecs.h.

◆ filter

ecs_filter_desc_t ecs_observer_desc_t::filter

Filter for observer.

Definition at line 871 of file flecs.h.

◆ last_event_id

int32_t* ecs_observer_desc_t::last_event_id

Optional shared last event id for multiple observers.

Ensures only one of the observers with the shared id gets triggered for an event

Definition at line 909 of file flecs.h.

◆ observable

ecs_poly_t* ecs_observer_desc_t::observable

Observable with which to register the observer.

Definition at line 905 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 filter, and calls 'callback' when it matches. A reason to override the run function is to improve performance, if there are more efficient way to test whether an event matches the observer than the general purpose query matcher.

Definition at line 890 of file flecs.h.

◆ term_index

int32_t ecs_observer_desc_t::term_index

Used for internal purposes.

Definition at line 912 of file flecs.h.

◆ yield_existing

bool ecs_observer_desc_t::yield_existing

When observer is created, generate events from existing data.

For example, EcsOnAdd Position would match all existing instances of Position. This is only supported for events that are iterable (see EcsIterable)

Definition at line 879 of file flecs.h.


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