From fb5920feec9483d28387d0dbffb977aea690586b Mon Sep 17 00:00:00 2001 From: photonstorm Date: Fri, 21 Feb 2014 17:29:51 +0000 Subject: [PATCH] We now force IE11 into Canvas mode to avoid a Pixi bug with pre-multiplied alpha. Will remove once that is fixed, sorry, but it's better than no game at all, right? :( Loader.setPreloadSprite() will now set sprite.visible = true once the crop has been applied. Should help avoid issues (#430) on super-slow connections. --- README.md | 2 ++ src/core/Game.js | 7 +++++++ src/loader/Loader.js | 8 ++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 89afd9b3d..94cfd4633 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,8 @@ Updates: * BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask. * The new GameObjectCreator (which you access via game.make or State.make) lets you easily create an object but NOT add it to the display list. * TilemapParser will now throw a warning if the tileset image isn't the right size for the tile dimensions. +* We now force IE11 into Canvas mode to avoid a Pixi bug with pre-multiplied alpha. Will remove once that is fixed, sorry, but it's better than no game at all, right? :( +* Loader.setPreloadSprite() will now set sprite.visible = true once the crop has been applied. Should help avoid issues (#430) on super-slow connections. Bug Fixes: diff --git a/src/core/Game.js b/src/core/Game.js index 06ced0d7e..0c64a6e8d 100644 --- a/src/core/Game.js +++ b/src/core/Game.js @@ -540,6 +540,13 @@ Phaser.Game.prototype = { */ setUpRenderer: function () { + if (this.device.trident) + { + // Pixi WebGL renderer on IE11 doesn't work correctly at the moment, the pre-multiplied alpha gets all washed out. + // So we're forcing canvas for now until this is fixed, sorry. It's got to be better than no game appearing at all, right? + this.renderType = Phaser.CANVAS; + } + if (this.renderType === Phaser.HEADLESS || this.renderType === Phaser.CANVAS || (this.renderType === Phaser.AUTO && this.device.webGL === false)) { if (this.device.canvas) diff --git a/src/loader/Loader.js b/src/loader/Loader.js index f6ee485fe..320a7a79e 100644 --- a/src/loader/Loader.js +++ b/src/loader/Loader.js @@ -144,10 +144,10 @@ Phaser.Loader.prototype = { /** * You can set a Sprite to be a "preload" sprite by passing it to this method. * A "preload" sprite will have its width or height crop adjusted based on the percentage of the loader in real-time. - * This allows you to easily make loading bars for games. + * This allows you to easily make loading bars for games. Note that Sprite.visible = true will be set when calling this. * * @method Phaser.Loader#setPreloadSprite - * @param {Phaser.Sprite} sprite - The sprite that will be cropped during the load. + * @param {Phaser.Sprite|Phaser.Image} sprite - The sprite that will be cropped during the load. * @param {number} [direction=0] - A value of zero means the sprite width will be cropped, a value of 1 means its height will be cropped. */ setPreloadSprite: function (sprite, direction) { @@ -169,6 +169,8 @@ Phaser.Loader.prototype = { sprite.crop(this.preloadSprite.crop); + sprite.visible = true; + }, /** @@ -1305,8 +1307,6 @@ Phaser.Loader.prototype = { { this.preloadSprite.crop.height = Math.floor((this.preloadSprite.height / 100) * this.progress); } - - // this.preloadSprite.sprite.crop = this.preloadSprite.crop; } this.onFileComplete.dispatch(this.progress, this._fileList[previousIndex].key, success, this.totalLoadedFiles(), this._fileList.length);