Jump to content

canvas.toDataURL() not displaying sprites


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"); 

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! 


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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