@touko1023 写道:
部分安卓 手机 分享 图片到 微信时,截图 显示不对,代码 如下
var size = cc.director.getWinSize();
var currentDate = new Date();
var fileName = "result_share.jpg";
var fullPath = jsb.fileUtils.getWritablePath() + fileName;
if (jsb.fileUtils.isFileExist(fullPath)) {
jsb.fileUtils.removeFile(fullPath);
}
//实现截屏
var texture = new cc.RenderTexture(640, 960, cc.Texture2D.PIXEL_FORMAT_RGBA8888, gl.DEPTH24_STENCIL8_OES);
//var texture = new cc.RenderTexture(640, 960);this.node.parent._sgNode.addChild(texture); //console.log(' this.node.parent : ', this.node.parent) texture.setVisible(false) texture.setPosition(cc.p(size.width / 2, size.height / 2)); texture.begin(); cc.director.getRunningScene().visit(); //针对单个节点截图 尝试失败 //this.shareResult._sgNode.visit(); //针对单个节点截图 尝试失败 texture.end(); //texture.saveToFile(fileName, cc.IMAGE_FORMAT_JPG); texture.saveToFile(fileName, cc.ImageFormat.PNG);
在截图之前,已经 把 数据(含图片,数字,文字等) 赋值给 某个节点了
但是 出来的 截图 是 该节点的 默认值(图片部分是 黑的,数字,文字等 是 节点 设置的 默认文字)
用的是cocosCreatoe 1.92 构建工程,然后用 AdroidStudio 3.12去 打包的
在线等 大神 帮助
帖子: 1
参与者: 1