求cocos2dx Android游戏截屏分享功能代码。多谢多谢
1 回答
犯罪嫌疑人X
TA贡献2080条经验 获得超4个赞
getScreenPic()写法如下(Native层):void FruitGameLayer::getScreenPic(){ CCSize size = CCDirector::sharedDirector()->getWinSize(); //定义一个屏幕大小的渲染纹理 CCRenderTexture* pScreen = CCRenderTexture::create(size.width,size.height, kCCTexture2DPixelFormat_RGBA8888); //获得当前的场景指针 CCScene* pCurScene = CCDirector::sharedDirector()->getRunningScene(); //渲染纹理开始捕捉 pScreen->begin(); //当前场景参与绘制 pCurScene->visit(); //结束捕捉 pScreen->end(); //保存为png pScreen->saveToFile("gameScreen.png", kCCImageFormatJPEG); CC_SAFE_DELETE(pScreen);}
- 1 回答
- 0 关注
- 1126 浏览
添加回答
举报
0/150
提交
取消