New API functions for creation of flecs API primtives #384
SanderMertens
started this conversation in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A new API has been introduced to create entities, components, types, queries, filters and triggers. The new API follows a pattern of an
init
function (where necessary with an accompanyingfini
function) that accepts a type that contains the parameters for the creation of that specific structure. For example, an entity can now be created like this:The new functions that have been introduced so far are:
The following creation functions have been removed or deprecated:
The ecs_new_prefab and ecs_new_pipeline functions can be replaced with ecs_entity_init and ecs_type_init:
The same approach will soon be applied to systems with an
ecs_system_init
function. The C++ API will also be updated in time, with new builder classes that populate the desc types.A new
ecs_term_t
datastructure has been introduced to describe filter/query terms. This replaces the existingecs_sig_column_t
type. There is not a 1-1 field mapping from the old to the new structure, as the new structure is designed to accommodate the new query language. As the new fields represent a superset of the old functionality, the old features (such asFromParent
) can still be expressed but in a different way. Theflecs.h
header contains a description of the type, more documentation will follow.The old
ecs_sig_t
structure has been removed from the core, and is now merged withecs_filter_t
. This means that queries are now constructed from filters, where a filter is essentially a list of terms. While the filter implementation is not yet updated (it still only reads theinclude
,exclude
fields), in time the filter iterator will also use the new term structure, which will significantly increase the expressiveness of filters.A new trigger API has been introduced which no longer requires importing the system module. Triggers are now a fully integrated part of the core. Triggers are single-term event listeners, where the term describes the interest of the trigger. Currently only basic triggers are supported, but the trigger API will be extended in the future to support the full expressiveness of a term.
Beta Was this translation helpful? Give feedback.
All reactions