How can I Snap the screen (PrtScn)

0 favourites
  • 5 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • hey

    i want to add to my game an option that the player will be able to snap the screen of the game and share it on facebook by pushing a button or even download it as a pic file

    someone know how can i do it?? <img src="smileys/smiley5.gif" border="0" align="middle" />

  • The bad thing is that Javascript can't access the Clipboard (where the PrintScreen is sotred), because of security restriction.

    So you need to have a plugin to render your layout to a PNG (for example the Canvas plugin from R0J0hound), and send that PNG.

  • Could paste all your game into a canvas object (see plugins). (that's for the snap part)

    For the sharing part you need a way to send image data in an ajax query. But as the default Ajax object use Get method I don't think you have enough room to send any screen size image.

    There's an Ajax plugin that use POST method somewhere in the plugin list but you still need a way to convert your canvas into image data and probably a php page to interprete it.

    And remember. I can be totally wrong with the sharing part but for the snap part that's how I would do it.

  • It should be possible by a plugin actually - a plugin could call toDataURL() on the main canvas and download a PNG of whatever the canvas is showing. You may not be able to copy it to the clipboard, but you could download it or upload it somewhere else.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thanks

    helps a lot!!

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