Skip to content

Commit ce474da

Browse files
committed
tweaks to Matter.Runner
1 parent 1810f93 commit ce474da

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/core/Runner.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ var Runner = {};
5050

5151
var runner = Common.extend(defaults, options);
5252

53-
runner.delta = 1000 / runner.fps;
54-
runner.deltaMin = 1000 / runner.fps;
55-
runner.deltaMax = 1000 / (runner.fps * 0.5);
53+
runner.delta = runner.delta || 1000 / runner.fps;
54+
runner.deltaMin = runner.deltaMin || 1000 / runner.fps;
55+
runner.deltaMax = runner.deltaMax || 1000 / (runner.fps * 0.5);
56+
runner.fps = 1000 / runner.delta;
5657

5758
return runner;
5859
};
@@ -135,6 +136,7 @@ var Runner = {};
135136
correction = 0;
136137

137138
runner.timeScalePrev = timing.timeScale;
139+
runner.correction = correction;
138140

139141
// fps counter
140142
runner.frameCounter += 1;
@@ -276,7 +278,7 @@ var Runner = {};
276278
*/
277279

278280
/**
279-
* A `Boolean` that specifies if the `Engine.run` game loop should use a fixed timestep (otherwise it is variable).
281+
* A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable).
280282
* If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic).
281283
* If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism).
282284
*

0 commit comments

Comments
 (0)