Skip to content

Commit d11d805

Browse files
committed
You can now prevent the Debug class from being created or booted by using the Game configuration setting: enableDebug. By default it is true, set to false to prevent the class from being created. Please note you are responsible for checking if this class exists before calling it, but you can do that via if (game.debug) { ... } (request phaserjs#984)
1 parent a182598 commit d11d805

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ Version 2.0.6 - "Jornhill" - -in development-
137137
* Rectangle.randomX will return a random value located within the horizontal bounds of the Rectangle.
138138
* Rectangle.randomY will return a random value located within the vertical bounds of the Rectangle.
139139
* Using a Game configuration object you can now specify the value of the `preserveDrawingBuffer` flag for the WebGL renderer. By default this is disabled for performance reasons. But if you need to be able to take screen shots of your WebGL games using toDataUrl on the game canvas then you'll need to set this to `true` (#987)
140+
* Added options to disable horizontal and vertical world wrapping individually (thanks @jackrugile, #988)
141+
* You can now prevent the Debug class from being created or booted by using the Game configuration setting: `enableDebug`. By default it is `true`, set to `false` to prevent the class from being created. Please note you are responsible for checking if this class exists before calling it, but you can do that via `if (game.debug) { ... }` (request #984)
140142

141143

142144
### Bug Fixes

src/core/Game.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
273273
}
274274
else
275275
{
276-
this.config = {};
276+
this.config = { enableDebug: true };
277277

278278
if (typeof width !== 'undefined')
279279
{
@@ -457,16 +457,19 @@ Phaser.Game.prototype = {
457457
this.particles = new Phaser.Particles(this);
458458
this.plugins = new Phaser.PluginManager(this);
459459
this.net = new Phaser.Net(this);
460-
this.debug = new Phaser.Utils.Debug(this);
461-
this.scratch = new Phaser.BitmapData(this, '__root', 1024, 1024);
462460

463461
this.time.boot();
464462
this.stage.boot();
465463
this.world.boot();
466464
this.input.boot();
467465
this.sound.boot();
468466
this.state.boot();
469-
this.debug.boot();
467+
468+
if (this.config['enableDebug'])
469+
{
470+
this.debug = new Phaser.Utils.Debug(this);
471+
this.debug.boot();
472+
}
470473

471474
this.showDebugHeader();
472475

0 commit comments

Comments
 (0)