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

use Matter.Runner in test worker

This commit is contained in:
liabru 2021-12-07 23:23:34 +00:00
parent a30707fd87
commit 2581595e6e

View file

@ -12,7 +12,12 @@ const runExample = options => {
const Examples = requireUncached('../examples/index');
const example = Examples[options.name]();
const engine = example.engine;
const runner = example.runner;
runner.delta = 1000 / 60;
runner.isFixed = true;
let totalMemory = 0;
let totalDuration = 0;
@ -25,7 +30,7 @@ const runExample = options => {
const startTime = process.hrtime();
totalMemory += process.memoryUsage().heapUsed;
Matter.Engine.update(engine, 1000 / 60);
Matter.Runner.tick(runner, engine, i * runner.delta);
const duration = process.hrtime(startTime);
totalDuration += duration[0] * 1e9 + duration[1];