cocos2d::CCImage* HelloWorld::createImageFromSprite(cocos2d::CCSprite *pSpr)
11.{
12.CCSprite* pNewSpr = CCSprite::createWithSpriteFrame(pSpr->displayFrame());
13.pNewSpr->setAnchorPoint(CCPointZero);
14.CCRenderTexture* pRender = CCRenderTexture::create(pNewSpr->getContentSize().width, pNewSpr->getContentSize().height, kCCTexture2DPixelFormat_RGBA8888);
15.pRender->begin();
16.pNewSpr->visit();
17.pRender->end();
18.return pRender->newCCImage();
19.}
时间: 2024-11-08 19:10:55