Entities · class
QueryCursor
Explained in Entities.
class QueryCursor implements Iterator<Entity>, Iterable<Entity>import { QueryCursor } from '@driftengine/entities';Constructor
new
constructor(host: CursorHost)| Parameter | Type | Description |
|---|---|---|
host | CursorHost |
Methods
open
open(a: ComponentType, b?: ComponentType, c?: ComponentType, d?: ComponentType): thisConfigure and take ownership.
| Parameter | Type | Description |
|---|---|---|
a | ComponentType | |
b? | ComponentType | |
c? | ComponentType | |
d? | ComponentType |
More
Four component types rather than a rest parameter, because ...types allocates an array on
every call — once per system per frame, which is exactly the hot path this file exists for.
Four covers every query in the corpus; a fifth is .with(), which is one more call and no
array either.
with
with(type: ComponentType): thisRequire a component without yielding anything about it.
| Parameter | Type | Description |
|---|---|---|
type | ComponentType |
without
without(type: ComponentType): thisExclude everything that has this component.
| Parameter | Type | Description |
|---|---|---|
type | ComponentType |
next
next(): IteratorResult<Entity>return
return(): IteratorResult<Entity>Called by for…of when a loop breaks, which is what stops an abandoned cursor leaking.
Signatures
[Symbol.iterator](): Iterator<Entity>
[Symbol.iterator](): Iterator<Entity>