lolyoshi
lolyoshi

Reputation: 1546

Cocos2dx - How to load resources in loading scene between scenes

I want to load resources in loading scene between scenes. I read they suggest preLoad but I have no idea to use it. Can you explain for me how it works?

Can you give me some detail example? Thanks

Upvotes: 0

Views: 3387

Answers (2)

Bilal Ahmed
Bilal Ahmed

Reputation: 358

After a long time of study i found that you can do that using: Sequence Action I got it working now in v-3x.

Upvotes: 1

Vikas Patidar
Vikas Patidar

Reputation: 43349

You can create a loading scene and load Images asynchronously using CCTextureCache::sharedTextureCache()->addImageAsync(...) method. It will add all images to shared texture chache. Whenever you create any Sprite or Texture it looks for key in CCTextureCache if there already a key exist then it will not load image again.

Alternatively you can remove textures from TextureCache using specific key name or all texture or unused ones.

Check API Here :

http://www.cocos2d-x.org/reference/native-cpp/V2.2.2/dd/d27/classcocos2d_1_1_c_c_texture_cache.html#a4397d1be3c0043536fdd32f55a54f747

Upvotes: 2

Related Questions