预加载图片:
1.CCTextureCache::sharedTextureCache()->addImage(
"icon.png"
);
2.CCTextureCache::sharedTextureCache()->addImageAsync("icon.png",this,callfuncO_selector(MainLayerLoading::loadingCallBack));
使用加载的缓存图片:
CCSprite* sp =CCSprite::createWithTexture(CCTextureCache::sharedTextureCache()->textureForKey("icon.png"));
释放预加载图片:
CCTextureCache::sharedTextureCache()->removeAllTextures();
预加载*.plist图片
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("test.plist");
使用预加载的缓存*.plist图片
1.CCSprite* sp = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName( "icon.png" ));
2.CCSpriteFrame* frameX = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName( "icon.png" );
释放预加载*.plist图片
CCSpriteFrameCache::sharedSpriteFrameCache()->removeSpriteFrames();
cocos2dx loading界面 预加载资源 与 资源释放