Jump to content

canvas.toDataURL() not displaying sprites


dorito
 Share

Recommended Posts

Hey guys, I'm trying to implement a feature where users can download a picture of the game canvas. The code below seems to be working:

var game = new Phaser.Game(900, 700, Phaser.CANVAS, 'gameDiv');

// buncha code adding images and sprites

var image = game.canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); 
window.location.href=image;  

However, the downloaded image has a big blank box cropped out (I've attached a screenshot to this post). I was wondering what could be causing this—could it be that a sprite is not rendering onto the canvas? I'm not familiar with how Phaser interacts with DOM elements, so thanks in advance for any advice! 

download

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...