Sprite 텍스처 교체

Cocos2Dx 2013. 6. 6. 20:41 |

void GameScene::swapSpriteTexture(CCSprite *a, CCTexture2D **b)
{
    CCTexture2D *tmp = a->getTexture();
    a->setTexture(*b);
    *b = tmp;
}

 

* 사용법

m_TextureSlot=(CCTexture2D *)CCTextureCache::sharedTextureCache()->addImage("smile.png");
this->swapSpriteTexture(aSprite, &m_TextureSlot);

 

Posted by maysent
: