Types
FullQuery[Comps] = distinct RawQuery[Comps]
- Allows systems to query for entities with specific components. Where Comps is a tuple of the components to fetch in this query. Provides access to the EntityId
Not[Comps] = distinct int8
- A query flag that indicates a component should be excluded from a query. Where Comps is the single component that should be excluded.
Query[Comps] = distinct RawQuery[Comps]
- Allows systems to query for entities with specific components. Where Comps is a tuple of the components to fetch in this query. Does not provide access to the entity ID
QueryConvert[Comps] = proc (input: pointer; adding: pointer; output: var Comps): bool {. ...gcsafe, raises: [], nimcall.}
- Copies the components of a single row into the shape a query asked for. Returns false for rows that the query turns out not to want after all
QueryGetSpan[Comps] = proc (appStatePtr: pointer; state: var uint; span: var QuerySpan[Comps]): bool {....gcsafe, raises: [], nimcall.}
QueryItem[Comps] = tuple[entityId: EntityId, components: Comps]
- An individual value yielded by a query. Where Comps is a tuple of the components to fetch in this query
QuerySpan[Comps] = object
- A run of consecutive rows belonging to one archetype. Queries hand these out rather than individual rows so that the walk over the rows stays in the caller, where the cursor lives in registers instead of behind a call
RawQuery[Comps] = ref object
- Allows systems to query for entities with specific components. Where Comps is a tuple of the components to fetch in this query.
Procs
proc asFullQuery[Comps](rawQuery: RawQuery[Comps]): FullQuery[Comps]
proc newQuery[Comps: tuple](appState: pointer; getLen: QueryGetLen; getSpan: QueryGetSpan[Comps]): RawQuery[Comps]
proc newQuerySpan[Comps: tuple](archSpan: ArchRowSpan; convert: QueryConvert[Comps]): QuerySpan[Comps] {. inline.}
- Describes a run of rows to be walked by a query
Iterators
iterator rows[Comps: tuple](span: QuerySpan[Comps]; slot: var Comps): RawArchRow
- Walks the rows of a span that the query actually wants, filling slot with the components of each