cocos2dx 动态替换图片

家住魔仙堡 提交于 2020-01-04 20:42:31

摸索很久才搞定,文件名相同时,替换精灵图片

 

void HelloWorld::UpatePicture( std::string path )

{

    CCImage* img = new CCImage();

    img->autorelease();

    img->initWithImageFile(path);

    cocos2d::CCTexture2D* texture = new cocos2d::CCTexture2D();

    texture->autorelease();

    texture->initWithImage(img);

    

    m_bk->setTexture(texture);

}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!