From 884acb06166838473e1ea2f0e7a760fc43215db5 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Tue, 29 Sep 2015 16:06:49 +0100 Subject: [PATCH] New Scale Manager stub added. Removes all Scale Manager handling from Phaser! But saves 75KB in the process. If you know you don't need to scale the Phaser canvas, or are handling that externally, then you can safely stub it out in a custom build. --- src/stubs/ScaleManager.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/stubs/ScaleManager.js diff --git a/src/stubs/ScaleManager.js b/src/stubs/ScaleManager.js new file mode 100644 index 000000000..ab2adeed0 --- /dev/null +++ b/src/stubs/ScaleManager.js @@ -0,0 +1,28 @@ +/** +* @author Richard Davey +* @copyright 2015 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ + +/** +* This is a stub for the Phaser ScaleManager. +* It allows you to exclude the default Scale Manager from your build, without making Game crash. +*/ + +Phaser.ScaleManager = function () { + + /** + * The bounds of the scaled game. The x/y will match the offset of the canvas element and the width/height the scaled width and height. + * @property {Phaser.Rectangle} bounds + * @readonly + */ + this.bounds = new Phaser.Rectangle(); + +}; + +Phaser.ScaleManager.prototype.boot = function () {}; +Phaser.ScaleManager.prototype.preUpdate = function () {}; +Phaser.ScaleManager.prototype.pauseUpdate = function () {}; +Phaser.ScaleManager.prototype.destroy = function () {}; + +Phaser.ScaleManager.prototype.constructor = Phaser.ScaleManager;