Search code examples
backgroundcocos2d-iphoneretina-displayshared-cache

Switch the cocos2d retina display background in runtime.


I've a background in my app, but clicking on a button should change it and use a different one.

I cannot add all of them in the sharedTextureCache because each one has a size of >16MB in the cache, and I've 30 different backgrounds.

What's the best way for switching the background without a loading time? I don't want the user to wait when clicking that button.

Thanks


Solution

  • The only way I managed to not slow down the app was with this line:

    [_background setTexture: [[CCTexture2D alloc] initWithImage:...]]
    

    When I try to use the shared Texture Cache, even asynchronously, the app slows down. :-O