Cocos2dx 3.0 提高篇(一) 初体验
来源:互联网 发布:安卓图像识别 单片机 编辑:程序博客网 时间:2024/04/30 14:22
转自:http://blog.csdn.net/start530/article/details/18052953
1、以CC开头的类从此去掉CC,如:
| v2.1 | v3.0 || CCSprite | Sprite || CCNode | Node || CCDirector | Director || etc... |
举个例子,创建一个精灵的方式:
- v2.0
- CCSprite* sp = CCSprite::create();
- v3.0
- auto sp = Sprite::create();
2、clone() 替代 copy(), 这个我用的不多,所以也就不多交代了;
3、Director的单例换成getInstance() 和 destroyInstance();
| v2.1 | v3.0 || CCDirector->sharedDirector() | Director->getInstance() || CCDirector->endDirector() | Director->destroyInstance() || etc... |
|4、新的触摸机制,先贴一段代码给大家看看,可能是下一篇或者下下篇我会详细讲下新的触摸机制的。(嘻嘻,搞得我好像很牛逼哄哄的样子)
- auto sprite = Sprite::create("file.png");
- ...
- auto listener = EventListenerTouchOneByOne::create();
- listener->setSwallowTouch(true);
- listener->onTouchBegan = [](Touch* touch, Event* event) { do_some_thing(); return true; };
- listener->onTouchMoved = [](Touch* touch, Event* event) { do_some_thing(); };
- listener->onTouchEnded = [](Touch* touch, Event* event) { do_some_thing(); };
- listener->onTouchCancelled = [](Touch* touch, Event* event) { do_some_thing(); };
- // The priority of the touch listener is based on the draw order of sprite
- EventDispatcher::getInstance()->addEventListenerWithSceneGraphPriority(listener, sprite);
- // Or the priority of the touch listener is a fixed value
- EventDispatcher::getInstance()->addEventListenerWithFixedPriority(listener, 100); // 100 is a fixed value
5、还有一些杂七杂八的东西,本人理解的不透,也就不发出来献丑了,最后将CCType.h 里的一些变动贴出来,让我们愉快的结束这篇博文。
| v2.1 struct names | v3.0 struct names || ccColor3B | Color3B || ccColor4B | Color4B || ccColor4F | Color4F || ccVertex2F | Vertex2F || ccVertex3F | Vertex3F || ccTex2F | Tex2F || ccPointSprite | PointSprite || ccQuad2 | Quad2 || ccQuad3 | Quad3 || ccV2F_C4B_T2F | V2F_C4B_T2F || ccV2F_C4F_T2F | V2F_C4F_T2F || ccV3F_C4B_T2F | V3F_C4B_T2F || ccV2F_C4B_T2F_Triangle | V2F_C4B_T2F_Triangle || ccV2F_C4B_T2F_Quad | V2F_C4B_T2F_Quad || ccV3F_C4B_T2F_Quad | V3F_C4B_T2F_Quad || ccV2F_C4F_T2F_Quad | V2F_C4F_T2F_Quad || ccBlendFunc | BlendFunc || ccT2F_Quad | T2F_Quad || ccAnimationFrameData | AnimationFrameData |
一些全局的定义:
继续...
| v2.1 names | v3.0 names || ccp | Point || ccpNeg | Point::- || ccpAdd | Point::+ || ccpSub | Point::- || ccpMult | Point::* || ccpMidpoint | Point::getMidpoint || ccpDot | Point::dot || ccpCrosss | Point::cross || ccpPerp | Point::getPerp || ccpRPerp | Point::getRPerp || ccpProject | Point::project || ccpRotate | Point::rotate || ccpUnrotate | Point::unrotate || ccpLengthSQ | Point::getLengthSq() || ccpDistanceSQ | Point::getDistanceSq || ccpLength | Point::getLength || ccpDistance | Point::getDistance || ccpNormalize | Point::normalize || ccpForAngle | Point::forAngle || ccpToAngle | Point::getAngle || ccpClamp | Point::getClampPoint || ccpFromSize | Point::Point || ccpCompOp | Point::compOp || ccpLerp | Point::lerp || ccpFuzzyEqual | Point::fuzzyEqual || ccpCompMult | Point::Point || ccpAngleSigned | Point::getAngle || ccpAngle | Point::getAngle || ccpRotateByAngle | Point::rotateByAngle || ccpLineInersect | Point::isLineIntersect || ccpSegmentIntersect | Point::isSegmentIntersect || ccpIntersectPoint | Point::getIntersectPoint || CCPointMake | Point::Point || CCSizeMake | Size::Size || CCRectMake | Rect::Rect || PointZero | Point::ZERO || SizeZero | Size::ZERO || RectZero | Rect::ZERO || TiledGrid3DAction::tile | TiledGrid3DAction::getTile || TiledGrid3DAction::originalTile | TiledGrid3DAction::getOriginalTile || TiledGrid3D::tile | TiledGrid3D::getTile || TiledGrid3D::originalTile | TiledGrid3D::getOriginalTile || Grid3DAction::vertex | Grid3DAction::getVertex || Grid3DAction::originalVertex | Grid3DAction::getOriginalVertex || Grid3D::vertex | Grid3D::getVertex || Grid3D::originalVertex | Grid3D::getOriginalVertex || Configuration::sharedConfiguration | Configuration::getInstance || Configuration::purgeConfiguration | Configuration::destroyInstance() || Director::sharedDirector() | Director::getInstance() || FileUtils::sharedFileUtils | FileUtils::getInstance || FileUtils::purgeFileUtils | FileUtils::destroyInstance || EGLView::sharedOpenGLView | EGLView::getInstance || ShaderCache::sharedShaderCache | ShaderCache::getInstance || ShaderCache::purgeSharedShaderCache | ShaderCache::destroyInstance || AnimationCache::sharedAnimationCache | AnimationCache::getInstance || AnimationCache::purgeSharedAnimationCache | AnimationCache::destroyInstance || SpriteFrameCache::sharedSpriteFrameCache | SpriteFrameCache::getInstance || SpriteFrameCache:: purgeSharedSpriteFrameCache | SpriteFrameCache::destroyInstance || NotificationCenter::sharedNotificationCenter | NotificationCenter::getInstance || NotificationCenter:: purgeNotificationCenter | NotificationCenter::destroyInstance || Profiler::sharedProfiler | Profiler::getInstance || UserDefault::sharedUserDefault | UserDefault::getInstance || UserDefault::purgeSharedUserDefault | UserDefault::destroyInstance || Application::sharedApplication | Application::getInstance || ccc3() | Color3B() || ccc3BEqual() | Color3B::equals() || ccc4() | Color4B() || ccc4FFromccc3B() | Color4F() || ccc4f() | Color4F() || ccc4FFromccc4B() | Color4F() || ccc4BFromccc4F() | Color4B() || ccc4FEqual() | Color4F::equals() || ccWHITE | Color3B::WHITE || ccYELLOW | Color3B::YELLOW || ccBLUE | Color3B::BLUE || ccGREEN | Color3B::GREEN || ccRED | Color3B::RED || ccMAGENTA | Color3B::MAGENTA || ccBLACK | Color3B::BLACK || ccORANGE | Color3B::ORANGE || ccGRAY | Color3B::GRAY || kBlendFuncDisable | BlendFunc::BLEND_FUNC_DISABLE |
0 0
- Cocos2dx 3.0 提高篇(一) 初体验
- Cocos2dx 3.0 过渡篇(一) 初体验
- Cocos2dx 3.0 过渡篇(一) 初体验
- Cocos2dx 3.0 过渡篇(一) 初体验
- Cocos2dx 3.0 过渡篇(一) 初体验
- Cocos2dx 3.0 过渡篇(一) 初体验
- Cocos2dx 3.0 过渡篇(一) 初体验
- Cocos2dx 3.0 提高篇(五) 随机数的获取(转)
- Cocos2dx 3.0 提高篇(八)浅谈容器Vector
- Cocos2dx 3.0 提高篇(九)浅谈容器Map
- Cocos2dx-Android初体验
- Cocos2dx-Android初体验
- Delphi2009初体验 - 语言篇 - 体验泛型(一)
- Cocos2dx 3.0 提高篇(十一) xml文档的读取与调用
- quick_cocos2dx 初体验 (一)
- Java初体验(一)
- ztree (一)----初体验
- ESP8266(一)初体验
- KVO的使用
- 黑马程序员——关于集合类的总结笔记
- 1.power designer 基本概念
- 深入理解linux系统下proc文件系统内容
- 超炫的JavaScript视觉效果
- Cocos2dx 3.0 提高篇(一) 初体验
- undefined reference to 'pthread_create'问题解决
- 游戏界面制作---旋转的地球
- InputStream与Reader的区别
- 程序员技术练级攻略
- mina源码分析一(转)
- 黑马程序员——关于逻辑运算符的总结
- 西部笔记本
- vs2010的动态链接库配置问题