Commented out all the bg color stuff. It now just changes the canvas CSS.

This commit is contained in:
photonstorm 2016-10-14 06:31:26 +01:00
parent 9961eeee6b
commit 386e22b0fd

View file

@ -20,7 +20,6 @@ Phaser.Stage = function (game) {
*/ */
this.game = game; this.game = game;
// PIXI.DisplayObjectContainer.call(this);
Phaser.GameObject.Container.call(this, game); Phaser.GameObject.Container.call(this, game);
/** /**
@ -80,14 +79,14 @@ Phaser.Stage = function (game) {
/** /**
* @property {number} _bgColor - Stage background color object. Populated by setBackgroundColor. * @property {number} _bgColor - Stage background color object. Populated by setBackgroundColor.
* @private * @private
*/ this._bgColor = { r: 255, g: 0, b: 255, a: 0, color: 0, rgba: 'rgba(0,0,0,0.1)' };
this._bgColor = { r: 0, g: 0, b: 0, a: 0, color: 0, rgba: '#000000' };
if (!this.game.transparent) if (!this.game.transparent)
{ {
// transparent = 0,0,0,0 - otherwise r,g,b,1 // transparent = 0,0,0,0 - otherwise r,g,b,1
this._bgColor.a = 1; // this._bgColor.a = 1;
} }
*/
if (game.config) if (game.config)
{ {
@ -96,7 +95,6 @@ Phaser.Stage = function (game) {
}; };
// Phaser.Stage.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
Phaser.Stage.prototype = Object.create(Phaser.GameObject.Container.prototype); Phaser.Stage.prototype = Object.create(Phaser.GameObject.Container.prototype);
Phaser.Stage.prototype.constructor = Phaser.Stage; Phaser.Stage.prototype.constructor = Phaser.Stage;
@ -135,6 +133,8 @@ Phaser.Stage.prototype.boot = function () {
this.checkVisibility(); this.checkVisibility();
this.setBackgroundColor('#000000');
}; };
/** /**
@ -143,9 +143,9 @@ Phaser.Stage.prototype.boot = function () {
* *
* @method Phaser.Stage#preUpdate * @method Phaser.Stage#preUpdate
*/ */
Phaser.Stage.prototype.preUpdate = function () { Phaser.Stage.prototype.preUpdate = function ()
{
this.transform.update(); this.worldAlpha = this.alpha;
this.currentRenderOrderID = 0; this.currentRenderOrderID = 0;
@ -207,23 +207,6 @@ Phaser.Stage.prototype.postUpdate = function () {
}; };
/**
* Updates the transforms for all objects on the display list.
* This overrides the Pixi default as we don't need the interactionManager, but do need the game property check.
*
* @method Phaser.Stage#updateTransform
*/
Phaser.Stage.prototype.updateTransform = function () {
// this.worldAlpha = 1;
// for (var i = 0; i < this.children.length; i++)
// {
// this.children[i].updateTransform();
// }
};
/** /**
* Starts a page visibility event listener running, or window.onpagehide/onpageshow if not supported by the browser. * Starts a page visibility event listener running, or window.onpagehide/onpageshow if not supported by the browser.
* Also listens for window.onblur and window.onfocus. * Also listens for window.onblur and window.onfocus.
@ -334,10 +317,11 @@ Phaser.Stage.prototype.visibilityChange = function (event) {
* @method Phaser.Stage#setBackgroundColor * @method Phaser.Stage#setBackgroundColor
* @param {number|string} color - The color of the background. * @param {number|string} color - The color of the background.
*/ */
Phaser.Stage.prototype.setBackgroundColor = function (color) { Phaser.Stage.prototype.setBackgroundColor = function (color)
{
if (this.game.transparent) { return; } this.game.canvas.style.backgroundColor = color;
/*
Phaser.Color.valueToColor(color, this._bgColor); Phaser.Color.valueToColor(color, this._bgColor);
Phaser.Color.updateColor(this._bgColor); Phaser.Color.updateColor(this._bgColor);
@ -346,6 +330,7 @@ Phaser.Stage.prototype.setBackgroundColor = function (color) {
this._bgColor.g /= 255; this._bgColor.g /= 255;
this._bgColor.b /= 255; this._bgColor.b /= 255;
this._bgColor.a = 1; this._bgColor.a = 1;
*/
}; };