Skip to content

Commit

Permalink
fix support for nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Jun 29, 2015
1 parent bc26469 commit b669ea0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/core/Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,24 @@ var Engine = {};
isFixed: false,
frameRequestId: 0
},
render: {
element: element,
controller: Render
},
broadphase: {
controller: Grid
}
};

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);
Expand Down
5 changes: 5 additions & 0 deletions src/core/Runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b669ea0

Please sign in to comment.