Search code examples
iphonecocos2d-x

Use of CCTexture2D in cocos2dx


I am new to cocos2d-x development. So any one tell me, how can i use CCTexture2D in cocos2Dx? So that i will use setTexture for CCSprite.
Thanks in advance.


Solution

  • you can create CCtexture2D by following line :

    CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(pszFileName);
    sprite -> setTexture(texture);
    

    I think this may useful to you.