ECS: {
    Entity: (() => Entity);
    Query: ((...components) => Query) & ((filter) => Query);
    System: ((name, stage, query, logic) => void);
    deleteEntity: ((entity) => void);
    getEntity: ((id) => Entity | undefined);
    run: (() => void);
}

Type declaration

  • Entity: (() => Entity)
      • (): Entity
      • Creates and registers a new entity.

        Returns Entity

        The newly created entity.

  • Query: ((...components) => Query) & ((filter) => Query)

    Creates and registers a new query.

    Param

    Components to include in the query.

    Param

    Filter condition for the query.

    Returns

    The newly created query.

  • System: ((name, stage, query, logic) => void)
      • (name, stage, query, logic): void
      • Creates and registers a new system.

        Parameters

        • name: string

          The name of the system.

        • stage: Stage

          The stage at which the system will run.

        • query: Query

          The query that selects entities for the system.

        • logic: ((entities) => void)

          Logic for each tick.

            • (entities): void
            • Parameters

              Returns void

        Returns void

  • deleteEntity: ((entity) => void)
      • (entity): void
      • Removes the provided entity from the ECS.

        Parameters

        • entity: Entity

          The entity to remove.

        Returns void

  • getEntity: ((id) => Entity | undefined)
      • (id): Entity | undefined
      • Retrieves an entity by its ID.

        Parameters

        • id: number

          The ID of the entity.

        Returns Entity | undefined

        The retrieved entity or undefined if not found.

  • run: (() => void)
      • (): void
      • Advances the ECS one tick by running each system.

        Returns void