9 years ago by Joncom
Someone correct me if I'm wrong here, but it seems that the debug module clocks are not necessarily accurate. Or at least, not what you might expect.
This is due to the order of operations that occur when classes
For example, the debug module injects a clock into
However, since this module is always loaded before our custom game class (lib/game/main.js), that means any modifications to
The same applies to the other clocks, such as the "update" clock. It&
I guess this is more of a heads up to others, than an actual bug report.
This is due to the order of operations that occur when classes
inject/extend to and from each other.For example, the debug module injects a clock into
ig.Game:
ig.Game.inject({
draw: function() {
ig.graph.beginClock('draw');
this.parent();
ig.graph.endClock('draw');
}
});
However, since this module is always loaded before our custom game class (lib/game/main.js), that means any modifications to
draw we make in our game class won't be clocked.
MyGame = ig.Game.extend({
// ...
// this draw function wraps after the debug version
draw: function() {
this.parent(); // will be clocked
this.drawGUI(); // will NOT be clocked
}
});
The same applies to the other clocks, such as the "update" clock. It&
039;s only measuring the vanilla game #update function, which includes updateEntities and checkEntities for example, but none of your custom game code.I guess this is more of a heads up to others, than an actual bug report.
