if (CC_JSB) {
//如果待截图的场景中含有 mask,请使用下面注释的语句来创建 renderTexture
var size = cc.view.getVisibleSize();
if (!this.renderTexture)
this.renderTexture = cc.RenderTexture.create(size.width, size.height, cc.Texture2D.PIXEL_FORMAT_RGBA8888, gl.DEPTH24_STENCIL8_OES);
//实际截屏的代码
this.renderTexture.begin();
cc.director.getRunningScene().visit();
this.renderTexture.end();
var filePath = jsb.fileUtils.getWritablePath() + "share.jpg"
this.renderTexture.saveToFile("share.jpg", cc.ImageFormat.JPG, true, function () {
console.log("capture screen successfully!filePath:" + filePath);
if (callback)
callback(filePath)
});
//打印截图路径
//cc.log(jsb.fileUtils.getWritablePath());
}
2赞
你在哪里写的,你是指刚刚插楼的那位朋友写的代码吗?我们是直接1.4.2升级上来的,这个段代码原封不动原来就是正常的。
你的意思是说,你们修改了命名吗?
那现在只要按照新的命名就能可以正常使用是吧?
是 asd
改成这个cc.ImageFormat.JPEG就会好了吗?
22 楼已经给了正确的写法了
好了,问题解决了,途中我没有仔细看楼层代码内容,导致了一些误会,在此表示抱歉。
感谢引擎团队和大家的帮助。
