Simulator

simulator~ Simulator

The Simulator is a utility class, it will setup a loop and call Engine.tick() for you automatically, optionally limiting the frames per second.

Constructor

new Simulator(engine)

Source:
Parameters:
Name Type Description
engine Engine

The Engine instance this simulator will control

Methods

getFps()

Source:
See:
  • setFps

Return current simulation fps limiter value.

isPaused() → {Boolean}

Source:

Check whether the simulation is paused

Returns:

true if simulator is paused, false otherwise

Type
Boolean

isRunning() → {Boolean}

Source:

Check whether the simulation is running

Returns:

true if simulator is running, false otherwise

Type
Boolean

pause()

Source:

Pause simulation

(private) run()

Source:

Simulation loop

setFps(fps)

Source:

Set simulation fps limiter value.
A value of 0 will disable the fps limiter

Parameters:
Name Type Description
fps Number

start()

Source:

Start simulation

stop()

Source:

Stop simulation and reset simulation time