转自 http://www.cppblog.com/merlinfang/archive/2013/08/06/202364.html
void ScreenShoot::screenShoot() { CCSize size = CCDirector::sharedDirector()->getWinSize(); //定义一个屏幕大小的渲染纹理; CCRenderTexture * pScreen = CCRenderTexture::create(size.width,size.height,kCCTexture2DPixelFormat_RGBA8888);//截取格式; //获取当前的场景指针: CCScene * pCurScene = CCDirector::sharedDirector()->getRunningScene(); //渲染纹理开始捕捉: pScreen->begin(); //当前场景参与绘制; this->visit();//pCurScene->visit(),这样用会发生访问冲突; //结束捕捉; pScreen->end(); //保存为png; pScreen->saveToFile("XXX.png",kCCImageFormatPNG);//保存为png格式的,kCCImageFormatJPG 保存为jpg格式的; CC_SAFE_DELETE(pScreen);//截完后删除; }原文链接:https://www.f2er.com/cocos2dx/345188.html