-
olegkarmanLikes 0Problem Description
Hello.
A few hours i’m trying to take a screenshot of my test scene, but everytime with some problem. First i’ve tried Cocos2d-js v3.10 and half of my scene was white. After that i’ve changed the engine to v3.14.1. Now there is no white sprites on my screenshot, but there are not all elements on it. Some of them are invisible.
Have a question like this. How to take a screenshot on Cocos2d-js framework with everything on it?
P.S. Here is my function to take screenshot:
function makeScreenShot(layerToPaste, layerToVisit) { cc.director.setNextDeltaTimeZero(true); var renderTexture = new cc.RenderTexture(cc.winSize.width, cc.winSize.height); renderTexture.begin(); layerToVisit.visit(); renderTexture.end(); renderTexture.setPosition(cc.winSize.width/2,cc.winSize.height/2); layerToPaste.addChild(renderTexture, 10000); }
-
Sonar Systems adminLikes 0
When you take the screenshot, is the scene static or are things changing?
-
olegkarmanLikes 0
One item, that is invisible, is an animation. Also i have a few buttons that are invisible in screenshot, but they are static.
-
Sonar Systems adminLikes 0
Try taking a screenshot of a simpler scene to see if that works.
-
olegkarmanLikes 0
I’ve tried to make screenshot on a puzzle game with no animation on it. As far as i understand, if the scene is completely static, Cocos will make correct screenshot, but with the animation the problems begins to occur.
-
Sonar Systems adminLikes 0
Check this video out and adapt it to javascript and it should be fine https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&cad=rja&uact=8&ved=0ahUKEwjK_4-uur_UAhWDuxQKHb8lA-QQtwIIQzAE&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DwsGo5MDcg1Y&usg=AFQjCNGsUiL7VWNtMTHPWQmZdQ42WCcasg&sig2=YAvbyM4rWYeLgvvI26cxkw
-
olegkarmanLikes 0
Ok, i will try. Thank you!
I see that this video is how to get screenshot on native platforms. But how about html5?
-
Sonar Systems adminLikes 0
Its for Cocos2d-x, you should be able to adapt the methods.
Login to reply