在c ++中的NSSortDescriptor替代品

时间:2014-01-22 07:08:19

标签: c++ objective-c cocos2d-iphone cocos2d-x

我将我的游戏从Cocos2d移植到Cocos2dx。我在模块中使用了以下代码

   enter code here
NSMutableArray * tempArray = roomModels;
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"displayOrder" ascending:YES];
[tempArray sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];

有没有解决办法使用Cocos2dx将此代码移植到c ++中?

1 个答案:

答案 0 :(得分:0)

Cocos2d适用于objC,但CocoS2dX设计为使用c ++,因此它有自己的集合对象,像NSMutableArray这样的objectiveC类被CCARRAY类取代。 阅读COCOS2Dx的官方文档以获取更多信息。 看看这里: http://www.cocos2d-x.org/wiki/Getting_Started