返回> 网站首页 

[转载]coocs2dx版本升级问题

yoours2014-06-22 10:42:08 阅读 1484

简介一边听听音乐,一边写写文章。

这里收集了一些:
http://www.cnblogs.com/TopWin/archive/2012/09/12/2682042.html
1.  SelectorProtocol  修改为:CCObject

2.  CCTouchDispatcher::sharedDispatcher()
修改为:CCDirector::sharedDirector()->getTouchDispatcher()

3.  error C2039: 'view' : is not a member of 'cocos2d::CCTouch'
分析:源码中的CCPoint location = touch->locationInView(touch->view());这一句过时了。修改为:
CCPoint location = touch->getLocationInView();

4.  CGFloat  => float

5. LAYER_NODE_FUNC改名为:CREATE_FUNC

6. node()方法更名为create().

7. virtual void update(ccTime dt) 改为:virtual void update(float dt)

8. Sprite.spriteWithSpriteFrameName改名为:Sprite.createWithSpriteFrameName

9. CCLabelTTF::labelWithString改为CCLabelTTF::create

10. CCMenuItemLabel::itemWithLabel改名为CCMenuItemLabel::create

11. CCMenu::menuWithItems改名为CCMenu::create

12. CCSpriteBatchNode::batchNodeWithTexture(texture); 改为CCSpriteBatchNode::createWithTexture(texture);

13. CCArray::arrayWithCapacity改为CCArray::createWithCapacity

14. CCTouch.locationInView更名为CCTouch.getLocationInView

1、CCScene和CCLayer的初始化统一用create()函数进行创建。

2、取消了CCMutableArray,借用CCArray来代替

另外,CCArray可以通过CCARRAY_FOREACH来进行遍历;

3、cocos2d::ccTime统一用float进行代替。

4、CCTouchDispatcher::sharedDispatcher()和CCDirector::sharedDirector()合并

5、一些get、set函数发生改变,比如setIsVisible变成setVisible,setIsTouchEnabled变成等setTouchEnabled等等

微信小程序扫码登陆

文章评论

1484人参与,0条评论