0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-28 14:09:01 -05:00

add delta control to demo gui

This commit is contained in:
liabru 2024-03-17 11:20:16 +00:00
parent 6e302a8724
commit 442814bccf

View file

@ -41,6 +41,22 @@ var demo = function(examples, isDev) {
document.title = 'Matter.js Demo' + (isDev ? ' ・ Dev' : ''); document.title = 'Matter.js Demo' + (isDev ? ' ・ Dev' : '');
if (isDev) { if (isDev) {
// add delta control
Matter.Common.chainPathAfter(MatterTools, 'Gui.create', function() {
this.datGui.__folders["Engine"]
.add(demo, "delta", 0, 1000 / 55)
.onChange(function() {
var runner = demo.example.instance.runner;
runner.delta = demo.delta;
})
.step(0.001)
.listen();
});
Matter.after('Runner.create', function() {
demo.delta = this.delta;
});
// add compare button // add compare button
var buttonSource = demo.dom.buttonSource, var buttonSource = demo.dom.buttonSource,
buttonCompare = buttonSource.cloneNode(true); buttonCompare = buttonSource.cloneNode(true);