Options
All
  • Public
  • Public/Protected
  • All
Menu

@jahed/ts-ecs

Index

Type aliases

Component

Component<T>: { data: T; type: Readonly<string> }

Type parameters

  • T = any

Type declaration

  • data: T
  • type: Readonly<string>

ComponentTemplate

ComponentTemplate<T, P>: (props: P) => T & { type: string }

Type parameters

  • T

  • P = any

ECS

Engine

Engine: ECS & { update: (elapsedMS: Milliseconds) => void }

Entity

Entity: { addComponent: <T>(component: Component<T>) => Entity; components: Map<string, Component>; getComponent: <T, P>(template: ComponentTemplate<T, P>) => Component<T>; hasComponent: <T, P>(template: ComponentTemplate<T, P>) => boolean; id: Readonly<string> }

Type declaration

EntityManager

EntityManager: { addComponent: <T>(entity: Entity, component: Component<T>) => void; addEntities: (...entities: Entity[]) => void; addEntity: (entity: Entity) => void; entities: Map<string, Entity>; getEntities: (...type: ComponentTemplate<any>[]) => Entity[]; getEntity: (...type: ComponentTemplate<any>[]) => Entity; getEntityById: (id: string) => Entity; removeComponent: <T, P>(entity: Entity, component: Component<T> | ComponentTemplate<T, P>) => void; removeEntity: (entity: Entity | string) => void; runTasks: () => void }

Type declaration

Milliseconds

Milliseconds: number

Space

Space: System & ECS

System

System: { added: (ecs: ECS) => void; disabled: (ecs: ECS) => void; enabled: (ecs: ECS) => void; id: Readonly<string>; removed: (ecs: ECS) => void; update: (ecs: ECS, elapsedMS: Milliseconds) => void }

Type declaration

  • added: (ecs: ECS) => void
      • (ecs: ECS): void
      • Parameters

        Returns void

  • disabled: (ecs: ECS) => void
      • (ecs: ECS): void
      • Parameters

        Returns void

  • enabled: (ecs: ECS) => void
      • (ecs: ECS): void
      • Parameters

        Returns void

  • id: Readonly<string>
  • removed: (ecs: ECS) => void
      • (ecs: ECS): void
      • Parameters

        Returns void

  • update: (ecs: ECS, elapsedMS: Milliseconds) => void

SystemManager

SystemManager: { addSystem: (system: System) => void; disableSystem: (system: System | string) => void; enableSystem: (system: System | string) => void; enabledSystems: Map<string, System>; removeSystem: (system: System | string) => void; runTasks: () => void; systems: Map<string, System> }

Type declaration

  • addSystem: (system: System) => void
      • Parameters

        Returns void

  • disableSystem: (system: System | string) => void
      • (system: System | string): void
      • Parameters

        Returns void

  • enableSystem: (system: System | string) => void
      • (system: System | string): void
      • Parameters

        Returns void

  • enabledSystems: Map<string, System>
  • removeSystem: (system: System | string) => void
      • (system: System | string): void
      • Parameters

        Returns void

  • runTasks: () => void
      • (): void
      • Returns void

  • systems: Map<string, System>

Task

Task: () => void

Type declaration

    • (): void
    • Returns void

Tasks

Tasks: Map<string, Task>

Functions

Const createComponent

Const createEngine

Const createEntity

  • createEntity(idTemplate: string): Entity

Const createSpace

  • createSpace(__namedParameters: CreateSpaceArgs): Space
  • Parameters

    • __namedParameters: CreateSpaceArgs

    Returns Space

Const createSystem

  • createSystem(__namedParameters: CreateSystemArgs): System

Const defineComponent

  • defineComponent<T, P>(type: string, factory: (props: P) => T): ComponentTemplate<T, P>
  • Type parameters

    • T

    • P = undefined

    Parameters

    • type: string
    • factory: (props: P) => T
        • (props: P): T
        • Parameters

          • props: P

          Returns T

    Returns ComponentTemplate<T, P>

Generated using TypeDoc