I’m James Chen, one of the maintainers of cocos2d-x. I have something to discuss with you guys about cocos2d-x 3.0.
After releasing the final version(2.1.4) of cocos2d-x 2.x, we are preparing cocos2d-x 3.0.
Ricardo Quesada * , the author of cocos2d-iphone, will spend his whole time in the development of cocos2d-x 3.0. I think cocos2d-x will be better and polished. Thanks @Riq.
You could get the message in the thread.
To make Cocos2d-x better, there are lots of things need to be done.
But first of all, we need a more CPP friendly version of cocos2d-x.
As Riq’s suggestion, we need to removeCC* prefix in cocos2d-x classes and use as many as c++ patterns rather than Objective-C patterns, like copyWithZone which is Objective-C stuff will be deprecated.
I did agree!
using namespace cocos2d; // ---- 1
CCSprite* sp = CCSprite::create("filename.png"); // Since we are using the namespace of cocos2d, why do we need CC prefix?
using namespace cocos2d;
Sprite* sp = Sprite::create("filename.png"); // more concise
However, I also decide to change the namespace from “cocos2d” to “cc”.
using namespace cc;
Sprite* sp = Sprite::create("filename.png");
and when there are conflicts with other libraries, we could
cc::Sprite* sp = cc::Sprite::create("filename.png");
It’s shorter and more compatible with JS, with objective-C, and with old version of cocos2d-x.
If not doing this, it’ll be:
cocos2d::Sprite* sp = cocos2d::Sprite::create("filename.png"); // Namespace is too long.
What’re your opinions about removing the CC prefix and changing the namespace from cocos2d to cc ?