cocos2d js 3.0 截屏功能怎么做~

是通过CCRenderTexture实现的嘛?求教程或代码~

/**

  • 截屏
  • /
    MainLayer.prototype.screenShot=function(picName){
    var renderTexture=cc.RenderTexture.create(720,1280,0,0);
    (renderTexture.getSprite()).setAnchorPoint(cc.p(0.5,0.5));
    renderTexture.setPosition(cc.p((720)/2,(1280)/2));
    renderTexture.setAnchorPoint(cc.p(0.5,0.5));
    renderTexture.begin();
    this.rootNode.visit();
    renderTexture.end();
    return renderTexture.saveToFile(picName,0);
    };
    貌似把对应的720
    1280改成你自己游戏实际分辨路就Ok

saveToFile isn’t supported on Cocos2d-Html5

— Begin quote from ____

引用第2楼happyfhc于2014-08-01 14:26发表的 :
saveToFile isn’t supported on Cocos2d-Html5 http://www.cocoachina.com/bbs/job.php?action=topost&tid=218113&pid=1019122

— End quote

Canvas.toDataURL(“image/png”)
然后上传到服务器,我是这么做的。

我也遇到这个问题了,有具体的代码么大神?我想学习一下

929013100@qq.com

多谢您了!

楼主问题解决了吗, 我也遇到了相同的问题 希望您能分享一下

857919442@qq.com

多谢啦!!!

楼主,你好,我想问两个问题。如果你有时间,还请你解答一下。
1、屏幕截图保存后,默认的根目录在哪里,要用的这张照片的时候怎么取出来呢?
2、如果想要后面截取得屏幕 替换 前面截取的屏幕,是不是只要文件名固定就直接替换了?
谢谢!

楼主,这个问题有解决的方法了吗?? 能分享下是怎么解决的吗

saveToFile isn’t supported on Cocos2d-Html5

小游戏的

H5的不支持saveToFile怎么破~