How to load FileUtils::getInstance()->getValueMapFromFile async?

Hi,

I have 2.5Mb plist file, no other options.
I need to load it asynchronously using FileUtils::getInstance()->getValueMapFromFile.
How can I do that? Ideally I need to create a progress bar of loading that file from 0 to 100%

Thanks.

Maybe load it while you have your main menu up? 2.5mb isn’t a lot unless you are loading it over the internet perhaps.

We have a loading bar: http://cocos2d-x.org/docs/cocos2d-x/en/ui_components/loading_bar.html

I don’t understand what it means - menu up. 2.5Mb if a lot for my game and I need to do it async, otherwise it’s freezes for a moment or loads too long, thats why I need progress.
I know all UI components of cocos2d-x. For now I’m loading my file using FileUtils::getInstance()->getValueMapFromFile in sync, so how to load it async?

I mean load it while you have something else going on. Perhaps using std::thread.

To be short, I just need async. Thats why I ask this my question, how to do that in cocos2d-x with all thread safety and race condition to be 100% eliminated. Any examples, code snippets, docs?

Maybe this will help: AsyncTaskPool working/example? .

2 Likes

I had forgotten about this. Thanks. http://www.cocos2d-x.org/docs/api-ref/cplusplus/v3x/d4/d56/classcocos2d_1_1_async_task_pool.html