Struct ecs_system_desc_t

Synopsis

#include <include/flecs/addons/system.h>

typedef struct ecs_system_desc_t

Description

No description yet.

Mentioned in

Source

Lines 39-94 in include/flecs/addons/system.h.

typedef struct ecs_system_desc_t {
    int32_t _canary;

    /* Existing entity to associate with system (optional) */
    ecs_entity_t entity;

    /* System query parameters */
    ecs_query_desc_t query;

    /* Callback that is invoked when a system is ran. When left to NULL, the
     * default system runner is used, which calls the "callback" action for each
     * result returned from the system's query. 
     * 
     * It should not be assumed that the input iterator can always be iterated
     * with ecs_query_next. When a system is multithreaded and/or paged, the
     * iterator can be either a worker or paged iterator. Future use cases may
     * introduce additional inputs for a system, such as rules and filters. The
     * correct function to use for iteration is ecs_iter_next.
     * 
     * An implementation can test whether the iterator is a query iterator by
     * testing whether the it->next value is equal to ecs_query_next. */
    ecs_run_action_t run;

    /* Callback that is ran for each result returned by the system's query. This
     * means that this callback can be invoked multiple times per system per
     * frame, typically once for each matching table. */
    ecs_iter_action_t callback;

    /* Context to be passed to callback (as ecs_iter_t::param) */
    void *ctx;

    /* Binding context, for when system is implemented in other language */
    void *binding_ctx;

    /* Functions that are invoked during system cleanup to free context data.
     * When set, functions are called unconditionally, even when the ctx
     * pointers are NULL. */
    ecs_ctx_free_t ctx_free;
    ecs_ctx_free_t binding_ctx_free;

    /* Interval in seconds at which the system should run */
    ecs_ftime_t interval;

    /* Rate at which the system should run */
    int32_t rate;

    /* External tick soutce that determines when system ticks */
    ecs_entity_t tick_source;

    /* If true, system will be ran on multiple threads */
    bool multi_threaded;

    /* If true, system will have access to actuall world. Cannot be true at the
     * same time as multi_threaded. */
    bool no_staging;
} ecs_system_desc_t;