void HelloWorld::screencapture(CCNode* p,...)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCRenderTexture* pScreen = CCRenderTexture::create(size.width,size.height);
va_list lst;
va_start(lst,p);
CCNode* pNow;
pNow=p;
while(p)
{
if (pNow)
{
pScreen->begin();
pNow->visit();
pScreen->end();
pNow=va_arg(lst,CCNode*);
}
else
break;
}
va_end(lst);
pScreen->saveToFile("screen/a.jpg");
CC_SAFE_DELETE(pScreen);
}
cocos2dx自定截屏函数。大家试试吧
最新推荐文章于 2021-06-28 19:01:27 发布