cocos2d 1.0及以上版本与0.xx版本某些类的变化
来源:互联网 发布:mac有程序阻止关机 编辑:程序博客网 时间:2024/06/16 05:39
1 CCMenuItemFont的itemFromString: target: selector:方法,该方法已被deprecated。]
新方法使用如下:
2 CCTransitionShrinkGrow等对象,原来均是以CCXXXTransition命名,而今变成了CCTransitionXXX。例如:
1.0版本以下 1.0版本及以上
CCShrinkGrowTransition CCTransitionShrinkGrow
CCSlideInRTransition CCTransitionSlideInR
CCSlideInRLransition CCTransitionSlideInL
3 CCBitmapFontAtlas对象没用了,改称了CCLabelBMFont。
1.0版本以前的用法:
1.0版本及以后的用法:
4 CCSpriteSheet对象也没有了,改成了CCSpriteBatchNode
1.0版本以前的用法:
1.0版本及以后的用法:
5 CCAnimation的animationWithName方法已被deprecated,改成了animationWithSpriteFrames
原用法:
1.0版本及以后的用法:
版本更新问题:
在编译这个的时候,出现了如标题中的错误
刚开始是搜索的错误,找了一大堆的英文的解决办法,包括那个大名鼎鼎的啥米溢出论坛,但是没结果,后来看到这个论坛的朋友给出了结果,觉得还是同胞亲哪。
11L大神给出了解决办法
在[self alloc]前面加上(ColorLayer*),如下:
新方法使用如下:
- CCMenuItem *GameSettings = [CCMenuItemFont itemWithString:@"设置" target:self selector:nil];
2 CCTransitionShrinkGrow等对象,原来均是以CCXXXTransition命名,而今变成了CCTransitionXXX。例如:
1.0版本以下 1.0版本及以上
CCShrinkGrowTransition CCTransitionShrinkGrow
CCSlideInRTransition CCTransitionSlideInR
CCSlideInRLransition CCTransitionSlideInL
3 CCBitmapFontAtlas对象没用了,改称了CCLabelBMFont。
1.0版本以前的用法:
- CCBitmapFontAtlas *lbScore = [CCBitmapFontAtlas bitmapFontAtlasWithString:@"Time: 0" fntFile:@"font09.fnt"];
1.0版本及以后的用法:
- CCLabelBMFont *lbScore = [CCLabelBMFont labelWithString:@"Time: 0" fntFile:@"font09.fnt"];
4 CCSpriteSheet对象也没有了,改成了CCSpriteBatchNode
1.0版本以前的用法:
- CCSpriteSheet *mgr = [CCSpriteSheet spriteSheetWithFile:@"flight.png" capacity:5];
1.0版本及以后的用法:
- CCSpriteBatchNode *mgr = [CCSpriteBatchNode batchNodeWithFile:@"flight.png" capacity:5];
5 CCAnimation的animationWithName方法已被deprecated,改成了animationWithSpriteFrames
原用法:
- CCAnimation *animation = [CCAnimation animationWithName:@"flight" delay:0.2f];
1.0版本及以后的用法:
- CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage:@"flight.png"];
- CCSpriteFrame *frame = [CCSpriteFrame frameWithTexture:texture rect:CGRectMake(0, 0, texture.contentSize.width, texture.contentSize.height)];
- NSArray *array = [[NSArray alloc] initWithObjects:frame, nil];
- CCAnimation *animation = [CCAnimation animationWithSpriteFrames:array delay:0.2f];
版本更新问题:
在编译这个的时候,出现了如标题中的错误
- + (id) layerWithColor:(ccColor4B)color
- {
- return [[[self alloc] initWithColor:color] autorelease];
- }
刚开始是搜索的错误,找了一大堆的英文的解决办法,包括那个大名鼎鼎的啥米溢出论坛,但是没结果,后来看到这个论坛的朋友给出了结果,觉得还是同胞亲哪。
11L大神给出了解决办法
在[self alloc]前面加上(ColorLayer*),如下:
- + (id) layerWithColor:(ccColor4B)color
- {
- return [[(ColorLayer*)[self alloc] initWithColor:color] autorelease];
- }
在新版本的cocos2d中ColorLayer更新为CCColorLayer了或者是CCLayerColor,两者是一样的。
转载自: http://lizi07.iteye.com/blog/1517652
- cocos2d 1.0及以上版本与0.xx版本某些类的变化
- Cocos2d-x 3.3版本及以上版本CCPointZero的改变
- MTK Android 5.0以上版本的变化
- MTK Android 5.0以上版本的变化
- MTK Android 5.0以上版本的变化
- Xcode6及以上版本,创建Auto Layout 约束时产生的一些变化
- Cocos2d-x 3.0及以上版本资源及脚本解密
- CentOS5.0以上版本安装盘的一些变化
- TortoiseSVN 1.7.0以上版本的重大变化
- Cocos2d-x 2.20及以上版本如何创建基于Lua的项目
- Cocos2d-x 2.20及以上版本如何创建基于Lua的项目
- 转载]cocos2d中CCAnimation的使用(cocos2d 1.0以上版本)
- MTK 10A版本及以上版本的编译配置
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- android eclipse下载
- 图解Visual Studio 2010中的UML建模功能
- STL中mem_fun和mem_fun_ref的用法
- mysql开启慢查询方法
- 程序员的选择
- cocos2d 1.0及以上版本与0.xx版本某些类的变化
- 使用UDEV在Oracle Linux 6上安装Oracle 11g RAC(11.2.0.3) (一)
- ping命令的结果写到硬盘上的文件中
- 10 步让你成为更优秀的程序员
- Core API之Method工具类
- Random Access Iterator
- NSDictionary和NSMutableDictionary例子微解
- Android是什么?
- 函数名、变量前后的_(一个下划线)、__(两个下划线)分别有什么用