diff --git a/src/core/Engine.js b/src/core/Engine.js index d3185749..ef9cd9b5 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -49,10 +49,6 @@ var Engine = {}; isFixed: false, frameRequestId: 0 }, - render: { - element: element, - controller: Render - }, broadphase: { controller: Grid } @@ -60,7 +56,17 @@ var Engine = {}; var engine = Common.extend(defaults, options); - engine.render = engine.render.controller.create(engine.render); + if (element && !engine.render) { + engine.render = { + element: element, + controller: Render + }; + } + + if (engine.render && engine.render.controller) { + engine.render = engine.render.controller.create(engine.render); + } + engine.world = World.create(engine.world); engine.pairs = Pairs.create(); engine.broadphase = engine.broadphase.controller.create(engine.broadphase); diff --git a/src/core/Runner.js b/src/core/Runner.js index dd35e4a6..c3022720 100644 --- a/src/core/Runner.js +++ b/src/core/Runner.js @@ -13,6 +13,11 @@ var Runner = {}; (function() { + if (typeof window === 'undefined') { + // TODO: support Runner on non-browser environments. + return; + } + var _fps = 60, _deltaSampleSize = _fps, _delta = 1000 / _fps;