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:
parent
bc26469df2
commit
b669ea0da1
2 changed files with 16 additions and 5 deletions
|
@ -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);
|
||||
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue