src/necsus/runtime/directives

Types

Attach[C] = CallbackDir[Arity2Proc[EntityId, C, void]]
Describes a type that is able to update existing entities new entities. Where C is a tuple with all the components to attach.
Bundle[T] = ptr T
A group of directives bundled together in an object
Delete = CallbackDir[Arity1Proc[EntityId, void]]
Deletes an entity and all associated components
DeleteAll[C] = CallbackDir[Arity0Proc[void]]
Deletes all entities matching a query
Detach[C] = CallbackDir[Arity1Proc[EntityId, void]]
Detaches a set of components from an entity. Where C is a tuple describing all the components to detach
EntityDebug = CallbackDir[Arity1Proc[EntityId, string]]
Looks up an entity and returns debug data about it
EventSystemInstance[T] = proc (event: T): void {.closure.}
Marks the return type for an instanced event system
Lookup[C] = CallbackDir[LookupProc[C]]
Looks up entity details based on its entity ID. Where C is a tuple with all the components to fetch
Outbox[T] = CallbackDir[OutboxProc[T]]
Sends an event. Where T is the message being sent
OutboxProc[T] = proc (app: pointer; message: T): void {.nimcall.}
Restore = CallbackDir[RestoreProc]
Executes all 'restore' systems using the given json as input data
Save = CallbackDir[SaveProc]
Generates a saved game state as a json value
SaveSystemInstance[T] = proc (): T {.closure.}
Marks the return type for an instanced save system
Swap[A; B] = CallbackDir[Arity2Proc[EntityId, A, void]]
A directive that adds components in A and removes components in B
SystemInstance = proc (): void {.closure.}
A callback used to invoke a specific system
TickId = CallbackDir[Arity0Proc[BiggestUInt]]
An auto-incrementing ID for each tick
TimeDelta = CallbackDir[Arity0Proc[BiggestFloat]]
Tracks the amount of time since the last execution of a system
TimeElapsed = CallbackDir[Arity0Proc[BiggestFloat]]
The total amount of time spent in an app

Procs

proc `()`(restore: Restore; value: string) {.
    ...raises: [IOError, OSError, JsonParsingError, ValueError, Exception],
    tags: [RootEffect], forbids: [].}
Executes a restore operation
proc `()`(save: Save): string {....raises: [IOError, OSError, ValueError, Exception],
                                tags: [RootEffect], forbids: [].}
Executes a save
proc `()`[A, B, T](comp: CallbackDir[Arity2Proc[A, B, T]]; a: A; b: B): T
Fetch a value out of a directive
proc `()`[A, T](comp: CallbackDir[Arity1Proc[A, T]]; a: A): T
Fetch a value out of a directive
proc `()`[C](lookup: Lookup[C]; entityId: EntityId): Option[C]
Executes a lookup
proc `()`[T](comp: CallbackDir[Arity0Proc[T]]): T
Fetch a value out of a directive
proc `()`[T](outbox: Outbox[T]; message: T)
Sends a message through an outbox
proc exec[A, B](comp: CallbackDir[Arity2Proc[A, B, void]]; a: A; b: B)
Execute a directive
proc exec[A](comp: CallbackDir[Arity1Proc[A, void]]; a: A)
Execute a directive
proc exec[T](outbox: Outbox[T]; message: T) {.inline.}
Sends a message through an outbox
proc get[A, B, T](comp: CallbackDir[Arity2Proc[A, B, T]]; a: A; b: B): T
Fetch a value out of a directive
proc get[A, T](comp: CallbackDir[Arity1Proc[A, T]]; a: A): T
Fetch a value out of a directive
proc get[C](lookup: Lookup[C]; entityId: EntityId): Option[C]
Executes a lookup
proc get[T](comp: CallbackDir[Arity0Proc[T]]): T
Fetch a value out of a directive
proc newCallbackDir[T: proc](appState: pointer; callback: T): CallbackDir[T]
Instantiates a directive that uses a callback