coocs2dx版本升级问题

本文提供了Cocos2d-x代码库中过时函数的更新建议,包括选择器协议、触摸事件处理、标签文本处理等关键部分的改进。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这里收集了一些:

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值