Skip to content

Commit edc1507

Browse files
committed
Resolved issue where Cocoon won't render a scene in Canvas mode if there is only one Sprite/Image on it.
1 parent eee1183 commit edc1507

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Version 2.0.6 - "Jornhill" - -in development-
6464
### CocoonJS Specific Updates
6565

6666
* Wrapped all touch, keyboard, mouse and fulscreen events that CocoonJS doesn't support in conditional checks to avoid Warnings.
67-
* Forces use of a Canvas Renderer under CocoonJS automatically.
6867
* The SoundManager no longer requires a touch to unlock it, defaults to unlocked.
68+
* Resolved issue where Cocoon won't render a scene in Canvas mode if there is only one Sprite/Image on it.
6969

7070
### New Features
7171

src/core/Game.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ Phaser.Game.prototype = {
542542
*/
543543
setUpRenderer: function () {
544544

545-
if (this.device.trident || this.device.cocoonJS)
545+
if (this.device.trident)
546546
{
547547
// Pixi WebGL renderer on IE11 doesn't work correctly at the moment, the pre-multiplied alpha gets all washed out.
548548
// 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 = {
633633
this.plugins.render();
634634
this.state.render();
635635
this.plugins.postRender();
636+
637+
if (this.device.cocoonJS && this.renderType === Phaser.CANVAS && this.stage.currentRenderOrderID === 1)
638+
{
639+
// Horrible hack! But without it Cocoon fails to render a scene with just a single drawImage call on it.
640+
this.context.fillRect(0, 0, 0, 0);
641+
}
636642
}
637643

638644
},

0 commit comments

Comments
 (0)