I’m translating some code from Objective-C to C++, and I have a doubt.
I have a plist structured like this:
(...keys and values...)
events
(... more keys and values...)
enemies
(... more keys and values...)
In cocos2d-iphone, I can read it like this:
NSString *levelsPlist = [[NSBundle mainBundle] pathForResource:@"Levels" ofType:@"plist"];
NSMutableArray *levelArray = [[NSMutableArray alloc] initWithContentsOfFile:levelsPlist];
NSDictionary *levelData = [[NSDictionary alloc] initWithDictionary:levelArray[level]];
But I’m unable to translate it to cocos2d-x. I’ve tried:
Array *levelArray = Array::createWithContentsOfFile("Levels.plist");
Dictionary *levelData = Dictionary::createWithDictionary((Dictionary*)levelArray[level]);
But no success (invalid cast).
Thank you for any help!