Skip to content

Commit fb5920f

Browse files
committed
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 (phaserjs#430) on super-slow connections.
1 parent 5a00a0a commit fb5920f

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ Updates:
138138
* BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask.
139139
* 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.
140140
* TilemapParser will now throw a warning if the tileset image isn't the right size for the tile dimensions.
141+
* 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? :(
142+
* Loader.setPreloadSprite() will now set sprite.visible = true once the crop has been applied. Should help avoid issues (#430) on super-slow connections.
141143

142144

143145
Bug Fixes:

src/core/Game.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,13 @@ Phaser.Game.prototype = {
540540
*/
541541
setUpRenderer: function () {
542542

543+
if (this.device.trident)
544+
{
545+
// Pixi WebGL renderer on IE11 doesn't work correctly at the moment, the pre-multiplied alpha gets all washed out.
546+
// 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?
547+
this.renderType = Phaser.CANVAS;
548+
}
549+
543550
if (this.renderType === Phaser.HEADLESS || this.renderType === Phaser.CANVAS || (this.renderType === Phaser.AUTO && this.device.webGL === false))
544551
{
545552
if (this.device.canvas)

src/loader/Loader.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ Phaser.Loader.prototype = {
144144
/**
145145
* You can set a Sprite to be a "preload" sprite by passing it to this method.
146146
* A "preload" sprite will have its width or height crop adjusted based on the percentage of the loader in real-time.
147-
* This allows you to easily make loading bars for games.
147+
* This allows you to easily make loading bars for games. Note that Sprite.visible = true will be set when calling this.
148148
*
149149
* @method Phaser.Loader#setPreloadSprite
150-
* @param {Phaser.Sprite} sprite - The sprite that will be cropped during the load.
150+
* @param {Phaser.Sprite|Phaser.Image} sprite - The sprite that will be cropped during the load.
151151
* @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.
152152
*/
153153
setPreloadSprite: function (sprite, direction) {
@@ -169,6 +169,8 @@ Phaser.Loader.prototype = {
169169

170170
sprite.crop(this.preloadSprite.crop);
171171

172+
sprite.visible = true;
173+
172174
},
173175

174176
/**
@@ -1305,8 +1307,6 @@ Phaser.Loader.prototype = {
13051307
{
13061308
this.preloadSprite.crop.height = Math.floor((this.preloadSprite.height / 100) * this.progress);
13071309
}
1308-
1309-
// this.preloadSprite.sprite.crop = this.preloadSprite.crop;
13101310
}
13111311

13121312
this.onFileComplete.dispatch(this.progress, this._fileList[previousIndex].key, success, this.totalLoadedFiles(), this._fileList.length);

0 commit comments

Comments
 (0)