2014-01-22 64 views
0

我將我的遊戲從Cocos2d移植到Cocos2dx。我在模塊中使用了下面的代碼C++中的NSSortDescriptor替代方案

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

有沒有解決方案使用Cocos2dx將此代碼移植到C++中?

回答

0

Cocos2d在objC上工作,但CocoS2dX被設計爲使用C++,因此它擁有自己的集合對象,像NSMutableArray這樣的objectiveC類被CCARRAY類所取代。 閱讀COCOS2Dx官方文檔獲取更多信息。 看看這裏: http://www.cocos2d-x.org/wiki/Getting_Started