mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -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,
|
isFixed: false,
|
||||||
frameRequestId: 0
|
frameRequestId: 0
|
||||||
},
|
},
|
||||||
render: {
|
|
||||||
element: element,
|
|
||||||
controller: Render
|
|
||||||
},
|
|
||||||
broadphase: {
|
broadphase: {
|
||||||
controller: Grid
|
controller: Grid
|
||||||
}
|
}
|
||||||
|
@ -60,7 +56,17 @@ var Engine = {};
|
||||||
|
|
||||||
var engine = Common.extend(defaults, options);
|
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.world = World.create(engine.world);
|
||||||
engine.pairs = Pairs.create();
|
engine.pairs = Pairs.create();
|
||||||
engine.broadphase = engine.broadphase.controller.create(engine.broadphase);
|
engine.broadphase = engine.broadphase.controller.create(engine.broadphase);
|
||||||
|
|
|
@ -13,6 +13,11 @@ var Runner = {};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
// TODO: support Runner on non-browser environments.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var _fps = 60,
|
var _fps = 60,
|
||||||
_deltaSampleSize = _fps,
|
_deltaSampleSize = _fps,
|
||||||
_delta = 1000 / _fps;
|
_delta = 1000 / _fps;
|
||||||
|
|
Loading…
Reference in a new issue