Options
All
  • Public
  • Public/Protected
  • All
Menu

Class World

A World ties everything together Usage:

const pixi = new PIXI.Application({ width: 600, height: 400});
const entityList = [list(), full(), of(), entities()]
const settings = {
    fps: 60,
    debug: false
}
const world = new World(pixi.view, entityList, [myUpdateSystem], [myRenderSystem], settings);
world.start()

Hierarchy

  • World

Index

Constructors

constructor

  • new World(pixi: Application, entities: Entity[], logicSystems: LogicSystem[], renderSystems: RenderSystem[], renderConfig?: RenderConfig): World
  • Main constructor

    Parameters

    • pixi: Application
    • entities: Entity[]
    • logicSystems: LogicSystem[]
    • renderSystems: RenderSystem[]
    • Default value renderConfig: RenderConfig = defaultRenderConfig

    Returns World

Properties

keyboard

keyboard: Keyboard

Contains current keyboard state, with keys pressed and so on

mouse

mouse: { pressed: boolean; x: number; y: number }

Contains the current mouse position

Type declaration

  • pressed: boolean
  • x: number
  • y: number

Methods

addEntity

  • addEntity(entity: Entity): void
  • Adds an entity to an already instantiated world. Updates system filters.

    Parameters

    Returns void

currentElapsedTime

  • currentElapsedTime(): number
  • Gets time elapsed since engine was started

    Returns number

removeEntity

  • removeEntity(entity: Entity): void
  • Removes an entity from an already instantiated world.

    Parameters

    Returns void

start

  • start(): void
  • Starts the game loop. Runs until stopped.

    Returns void

Generated using TypeDoc