cocos2d-js 分享截屏-js代码
来源:互联网 发布:中国运营商网络制式 编辑:程序博客网 时间:2024/05/16 11:31
//depthStencilFormat == 0x88F0//这样就可以分享带有scrollview的界面截屏了。否则会出现空白的部分captureAndShareToWX: function (node, depthStencilFormat) { var winSize = cc.director.getWinSize(); var texture = new cc.RenderTexture(winSize.width, winSize.height, null, depthStencilFormat); if (!texture) return; texture.retain(); texture.setAnchorPoint(0, 0); texture.begin(); node.visit(); texture.end(); //实现截屏的部分 var time = timestamp2time(Math.round((new Date()).valueOf() / 1000));//时间转化格式 var nameJPG = "ss-" + time + ".jpg"; if (cc.sys.os == cc.sys.OS_ANDROID) { //保存图片路径 texture.saveToFile(nameJPG, cc.IMAGE_FORMAT_JPEG, false, function (renderTexture, str) { texture.release(); jsb.reflection.callStaticMethod( // 调用底包的方法,实现分享到微信 packageUri + "/utils/WeixinUtil", "sharePic", "(Ljava/lang/String;Z)V", nameJPG, false ); }); } else if (cc.sys.os == cc.sys.OS_IOS) { texture.saveToFile(nameJPG, cc.IMAGE_FORMAT_JPEG, true, function (renderTexture, str) { texture.release(); jsb.reflection.callStaticMethod(//调用底包方法分享到微信 "WXUtil", "sharePic:imageName:sceneType:", jsb.fileUtils.getWritablePath(), nameJPG, 0 ); }); } },
阅读全文
0 0
- cocos2d-js 分享截屏-js代码
- js快速分享代码
- JS分享代码
- 百度分享js代码
- js快速分享代码
- js分享代码
- 百度分享js代码
- cocos2d js 发布代码方法
- cocos2d-js 热更新代码
- cocos2d-js 自动绑定代码
- cocos2d-js 自动绑定代码
- 微信分享JS代码 WeixinApi.js
- 微信分享JS代码 WeixinApi.js
- [分享] JS精华代码集
- 分享微博js代码
- 百度网页分享js代码
- 微信分享,js代码
- 微信分享-js代码
- 趟过的那些坑-listview addfootview点击
- 最大质因数
- python -- 教室调度问题
- Boostnote是什么?-是为程序员开发的一种开放源代码记事本
- C/C++ << 左移运算符,. >>右移运算符
- cocos2d-js 分享截屏-js代码
- Fastjson
- Android 使用RenderScript 实现毛玻璃(模糊)
- python使用xlrd读取excel数据时,整数和日期变小数的解决办法
- Android从入门到转行之登陆
- codeforce 847B Preparing for Merge Sort
- Linux PCB,process descriptor,task_struct,thread_info区别与联系
- USB驱动开发之USB四种传输模式
- HADOOP编译WordCount.java文件报错