src/necsus/runtime/world

Types

ArchetypeId = distinct BiggestInt
EntityIndex = object
  entityId*: EntityId
  archetype*: ArchetypeId
  archetypeIndex*: uint
NewEntity = distinct ptr EntityIndex
World = object
Contains the data describing the entire world

Procs

proc `[]`(world: World; entityId: EntityId): ptr EntityIndex {....raises: [],
    tags: [], forbids: [].}
Look up entity information based on an entity ID
proc del(world: var World; entityId: EntityId): Option[EntityIndex] {.
    ...raises: [], tags: [], forbids: [].}
Deletes an entity and returns the archetype and index that also needs to be deleted
proc entityId(newEntity: NewEntity): EntityId {....raises: [], tags: [],
    forbids: [].}
Returns the entity ID of a newly created entity
proc getNewEntityId(world: var World): EntityId {.inline, ...raises: [], tags: [],
    forbids: [].}
proc newEntity(world: var World): NewEntity {....raises: [], tags: [], forbids: [].}
Constructs a new entity and invokes
proc newWorld(initialSize: SomeInteger): World
Creates a new world
proc setArchetypeDetails(entry: NewEntity; archetype: ArchetypeId; index: uint) {.
    ...raises: [], tags: [], forbids: [].}
Stores the archetype details about an entity