Events call the world directly, avoids an unnecessary function jump.

This commit is contained in:
Richard Davey 2018-01-17 15:28:53 +00:00
parent f41d016c9f
commit 108b6bd2a3
3 changed files with 5 additions and 30 deletions

View file

@ -49,22 +49,12 @@ var ArcadePhysics = new Class({
this.systems.inject(this); this.systems.inject(this);
this.systems.events.on('update', this.update, this); this.systems.events.on('update', this.world.update, this.world);
this.systems.events.on('postupdate', this.postUpdate, this); this.systems.events.on('postupdate', this.world.postUpdate, this.world);
this.systems.events.on('shutdown', this.shutdown, this); this.systems.events.on('shutdown', this.shutdown, this);
this.systems.events.on('destroy', this.destroy, this); this.systems.events.on('destroy', this.destroy, this);
}, },
update: function (time, delta)
{
this.world.update(time, delta);
},
postUpdate: function ()
{
this.world.postUpdate();
},
overlap: function (object1, object2, overlapCallback, processCallback, callbackContext) overlap: function (object1, object2, overlapCallback, processCallback, callbackContext)
{ {
if (overlapCallback === undefined) { overlapCallback = null; } if (overlapCallback === undefined) { overlapCallback = null; }

View file

@ -49,16 +49,11 @@ var ImpactPhysics = new Class({
this.systems.inject(this); this.systems.inject(this);
this.systems.events.on('update', this.update, this); this.systems.events.on('update', this.world.update, this.world);
this.systems.events.on('shutdown', this.shutdown, this); this.systems.events.on('shutdown', this.shutdown, this);
this.systems.events.on('destroy', this.destroy, this); this.systems.events.on('destroy', this.destroy, this);
}, },
update: function (time, delta)
{
this.world.update(time, delta);
},
shutdown: function () shutdown: function ()
{ {
this.world.shutdown(); this.world.shutdown();

View file

@ -72,8 +72,8 @@ var MatterPhysics = new Class({
this.systems.inject(this); this.systems.inject(this);
this.systems.events.on('update', this.update, this); this.systems.events.on('update', this.world.update, this.world);
this.systems.events.on('postupdate', this.postUpdate, this); this.systems.events.on('postupdate', this.world.postUpdate, this.world);
this.systems.events.on('shutdown', this.shutdown, this); this.systems.events.on('shutdown', this.shutdown, this);
this.systems.events.on('destroy', this.destroy, this); this.systems.events.on('destroy', this.destroy, this);
}, },
@ -94,16 +94,6 @@ var MatterPhysics = new Class({
return this; return this;
}, },
update: function (time, delta)
{
this.world.update(time, delta);
},
postUpdate: function (time, delta)
{
this.world.postUpdate(time, delta);
},
shutdown: function () shutdown: function ()
{ {
this.world.shutdown(); this.world.shutdown();