Skip to content

Commit 108b6bd

Browse files
committed
Events call the world directly, avoids an unnecessary function jump.
1 parent f41d016 commit 108b6bd

3 files changed

Lines changed: 5 additions & 30 deletions

File tree

src/physics/arcade/ArcadePhysics.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,12 @@ var ArcadePhysics = new Class({
4949

5050
this.systems.inject(this);
5151

52-
this.systems.events.on('update', this.update, this);
53-
this.systems.events.on('postupdate', this.postUpdate, this);
52+
this.systems.events.on('update', this.world.update, this.world);
53+
this.systems.events.on('postupdate', this.world.postUpdate, this.world);
5454
this.systems.events.on('shutdown', this.shutdown, this);
5555
this.systems.events.on('destroy', this.destroy, this);
5656
},
5757

58-
update: function (time, delta)
59-
{
60-
this.world.update(time, delta);
61-
},
62-
63-
postUpdate: function ()
64-
{
65-
this.world.postUpdate();
66-
},
67-
6858
overlap: function (object1, object2, overlapCallback, processCallback, callbackContext)
6959
{
7060
if (overlapCallback === undefined) { overlapCallback = null; }

src/physics/impact/ImpactPhysics.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,11 @@ var ImpactPhysics = new Class({
4949

5050
this.systems.inject(this);
5151

52-
this.systems.events.on('update', this.update, this);
52+
this.systems.events.on('update', this.world.update, this.world);
5353
this.systems.events.on('shutdown', this.shutdown, this);
5454
this.systems.events.on('destroy', this.destroy, this);
5555
},
5656

57-
update: function (time, delta)
58-
{
59-
this.world.update(time, delta);
60-
},
61-
6257
shutdown: function ()
6358
{
6459
this.world.shutdown();

src/physics/matter-js/MatterPhysics.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ var MatterPhysics = new Class({
7272

7373
this.systems.inject(this);
7474

75-
this.systems.events.on('update', this.update, this);
76-
this.systems.events.on('postupdate', this.postUpdate, this);
75+
this.systems.events.on('update', this.world.update, this.world);
76+
this.systems.events.on('postupdate', this.world.postUpdate, this.world);
7777
this.systems.events.on('shutdown', this.shutdown, this);
7878
this.systems.events.on('destroy', this.destroy, this);
7979
},
@@ -94,16 +94,6 @@ var MatterPhysics = new Class({
9494
return this;
9595
},
9696

97-
update: function (time, delta)
98-
{
99-
this.world.update(time, delta);
100-
},
101-
102-
postUpdate: function (time, delta)
103-
{
104-
this.world.postUpdate(time, delta);
105-
},
106-
10797
shutdown: function ()
10898
{
10999
this.world.shutdown();

0 commit comments

Comments
 (0)