Texture not load correctly

Hi all,

I am developing game for wp8.

Texture sometimes can not load correctly and only show black image.
I attached the screenshot.
This is happened after many times playing the game.

Detail :

  • cocos2d-x 2.2.1
  • Nokia Lumia 520
  • Visual Studio Express 2012 for Windows Phone
  • Windows 8.0

PS:

  • On every scene, i remove all texture and sprite frame cache, and load new texture for current scene

My code :
@
CCSpriteFrameCache::sharedSpriteFrameCache()->removeSpriteFrames();
CCTextureCache::sharedTextureCache()->removeAllTextures();
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“scene/mainscene.plist”);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“marble/polos/marbles.plist”);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“marble/tattoo/tattoo.plist”);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“marble/items/items.plist”);
@


wp_ss_20131212_0002[1].png (45.9 KB)

Really strange,

I try to turn off background music, and everything goes fine.
I have many background music, different on every scene so i unload and preload background music.

here the example :

void Util_SoundManager::playBackgroundMain() {
    if (musicId == MUSIC_ID_MAIN) {
        return;
    }
    SimpleAudioEngine::sharedEngine()->stopBackgroundMusic(true);
    if (music) {
        musicId = MUSIC_ID_MAIN;
        std::stringstream filename;
        filename << "marble/sfx/" << ext.c_str() << "/music_main2." << ext.c_str();
        SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(filename.str().c_str());
        SimpleAudioEngine::sharedEngine()->playBackgroundMusic(filename.str().c_str(), true);
    }
}

Maybe background music not unload correctly.