| Top |
| LeecsIterator * | leecs_query_archetypes () |
| LeecsEntity | leecs_find_one_archetype () |
| bool | leecs_iterator_next () |
| void | leecs_iterator_free () |
| #define | leecs_query_entities() |
| #define | leecs_find_one_entity() |
LeecsIterator * leecs_query_archetypes (LeecsWorld *world,const char *name);
Creates a LeecsIterator for world
to find entities with the archetype
named name
.
LeecsEntity leecs_find_one_archetype (LeecsWorld *world,const char *name);
bool leecs_iterator_next (LeecsIterator *iterator,LeecsEntity *entity);
Finds the next LeecsEntity matching the query parameters or returns false
if another LeecsEntity can't be found.
Example usage:
1 2 3 4 5 6 7 8 |
LeecsEntity entity; LeecsIterator *iterator; iterator = leecs_query_entities (world, Position, Velocity); while (leecs_iterator_next (iterator, &entity)) { ... } |
void
leecs_iterator_free (LeecsIterator *iterator);
Frees all memory associated with iterator
. A LeecsIterator is freed
automatically when it can no longer find another entity, but if you want to
stop iterating before that, you must call this function.
Example usage:
1 2 3 4 5 6 7 8 9 10 |
while (leecs_iterator_next (iterator, &entity)) { if (condition) { leecs_iterator_free (iterator); break; } ... } |
#define leecs_query_entities(world, ...)
Creates a LeecsIterator for world
to find entities with at least the
components included in the list.
typedef struct _LeecsIterator LeecsIterator;
Iterator for entities. Iterators are used when querying entities. An
iterator is created when calling leecs_query_entities() or
leecs_query_archetype(), and entities are accessed from the iterator using
leecs_iterator_next().
When leecs_iterator_next() no longer finds another entity, the iterator is
automatically freed. But if at any point you want to stop iterating over
entities before arriving at the final one, you must manually call
leecs_iterator_free() to free the iterator.