Taking Screenshot in Defold

Hi there,

I am developing a little app where the player can build a monument.
I want to allow the player to take a screenshot of the result with a button inside the application to printed it.

Here is the result that I am looking for :

I have tried to do it with javascript using the command window.print() but, here is the result :

I have also tried to do it using html2canvas, but I get the same result.
I do not really understand why I’m getting this.

Have you got any idea about this ?

(I apologize for my english)

You will be wanting to look at this extension by @britzl, for that!

Ah yes Defold-Screenshot solves screenshot taking on all platforms but HTML5. It’s non trivial to take a screenshot in HTML5 apps, considering the security implications it would have. There are alternatives such as rendering to a texture, grabbing the pixel data using a a buffer and then encoding and saving that.

2 Likes

That sounds good.
It reassures me to know that there is a solution.
I never used this kind of stuff before, do you have any recommandations to begin that ?

Thank to you two.
It’s already helps me a lot :smile: