Resolved issue where Cocoon won't render a scene in Canvas mode if there is only one Sprite/Image on it.

This commit is contained in:
photonstorm 2014-05-29 23:52:13 +01:00
parent eee1183a6a
commit edc1507b4e
2 changed files with 8 additions and 2 deletions

View file

@ -64,8 +64,8 @@ Version 2.0.6 - "Jornhill" - -in development-
### CocoonJS Specific Updates
* Wrapped all touch, keyboard, mouse and fulscreen events that CocoonJS doesn't support in conditional checks to avoid Warnings.
* Forces use of a Canvas Renderer under CocoonJS automatically.
* The SoundManager no longer requires a touch to unlock it, defaults to unlocked.
* Resolved issue where Cocoon won't render a scene in Canvas mode if there is only one Sprite/Image on it.
### New Features

View file

@ -542,7 +542,7 @@ Phaser.Game.prototype = {
*/
setUpRenderer: function () {
if (this.device.trident || this.device.cocoonJS)
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?
@ -633,6 +633,12 @@ Phaser.Game.prototype = {
this.plugins.render();
this.state.render();
this.plugins.postRender();
if (this.device.cocoonJS && this.renderType === Phaser.CANVAS && this.stage.currentRenderOrderID === 1)
{
// Horrible hack! But without it Cocoon fails to render a scene with just a single drawImage call on it.
this.context.fillRect(0, 0, 0, 0);
}
}
},