0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-25 13:39:06 -05:00

fix support for nodejs

This commit is contained in:
liabru 2015-06-29 20:57:41 +01:00
parent bc26469df2
commit b669ea0da1
2 changed files with 16 additions and 5 deletions

View file

@ -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);

View file

@ -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;