Has anyone tried? Cavas Snapshot/CocoonJS

0 favourites
  • 4 posts
  • Hello all,

    I have a game that's basically a paint editor with goals on each stage. I'm working on adding the ability to save your art as a JPG/PNG.

    I started by taking a snapshot of the canvas and invoking a download; which worked fine on Android and PC but did not work on my iPhone. I'm not sure if it not working on iOS is a bug or not but I'll investigate later.

    To get around the limitation and to deliver the same experience on every platform I started writing a node.js server. The server will accept a POST with the image then it will send it to the provided email. I'm about 2/3 done with it when I realized I'm not sure if CocoonJS supports screenshots! I'll test it once I have time but I figured I ask the community in the meantime.

    tl;dr

    Has anyone tried using the "Take screenshot of Canvas" action with CocoonJS?

    Thanks all!

  • Hi

    I briefly experimented with using the system "Take snapshot of canvas" action with CocoonJS. I actually did have success in sending the snapshot to WebStorage and then using the "Load image from URL" function of a blank sprite object and entering the WebStorage.LocalValue contents. Interestingly, I had to Flip the sprite for it to display properly.

    However, I believe there are several obstacles to work around, as I was getting a Javascript exception ('requestAnimationFrame'): texImage2D IllegalArgumentException: Cannot open the given '/private/var/mobile/Applications/blah blah extremely long series of characters that expect represent the JPEG image in WebStorage. Not sure why I get this, as the sprite is deleted when I change layouts and I only get the error when trying to go back to the layout where I originally displayed the sprite.

    Anyway, figured I would post and see if any of that is helpful. :) I'm on the latest C2 release, r143, and CJS 1.4.

  • As a follow up, I do not get a javascript exception when using a Tiled Background instead of a Sprite, however I am unable to flip the tbg to correct the image.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Can you please share code or capx for saving a snapshot in cocoonjs android.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)