cocos2dx 3.0一些变化

cocos2dx 3.0一些变化,第1张

概述转自 http://blog.csdn.net/start530/article/details/18052953 1、以CC开头的类从此去掉CC,如: | v2.1 | v3.0 || CCSprite | Sprite || CCNode | Node || CCDirector | Director || etc...

转自http://blog.csdn.net/start530/article/details/18052953


1、以CC开头的类从此去掉CC,如:

| v2.1       | v3.0     || CCSprite   | Sprite   || CCNode     | Node     || CCDirector | Director || etc...                |

举个例子,创建一个精灵的方式:
@H_502_18@ [cpp] view plain copy v2.0 CCSprite*sp=CCSprite::create(); v3.0 autosp=Sprite::create();

2、clone() 替代 copy(),这个我用的不多,所以也就不多交代了;
3、Director的单例换成getInstance() 和 destroyInstance();
| v2.1                          | v3.0                        || CCDirector->sharedDirector()  | Director->getInstance()     || CCDirector->endDirector()     | Director->destroyInstance() || etc...                                                      |
|
4、新的触摸机制,先贴一段代码给大家看看,可能是下一篇或者下下篇我会详细讲下新的触摸机制的。
autosprite=Sprite::create("file.png"); ... autoListener=EventListenertouchOneByOne::create(); Listener->setSwallowtouch(true); Listener->ontouchBegan=[](touch*touch,Event*event){do_some_thing();returntrue;}; Listener->ontouchmoved=[](touch*touch,Event*event){do_some_thing();}; Listener->ontouchended=[](touch*touch,Event*event){do_some_thing();}; Listener->ontouchCancelled=[](touch*touch,108); List-style:decimal-leading-zero outsIDe; color:inherit; line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> //ThepriorityofthetouchListenerisbasedonthedraworderofsprite Eventdispatcher::getInstance()->addEventListenerWithSceneGraPHPriority(Listener,sprite); //OrthepriorityofthetouchListenerisafixedvalue Eventdispatcher::getInstance()->addEventListenerWithFixedPriority(Listener,100);//100isafixedvalue
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 |

一些全局的定义

// in v2.1cccolor3B color3B = ccc3(0, 0);ccc3BEqual(color3B, ccc3(1,153)">1));cccolor4B color4B = ccc4(0);cccolor4F color4F = ccc4f(0);color4F = ccc4FFromccc3B(color3B);color4F = ccc4FFromccc4B(color4B);ccc4FEqual(color4F, ccc4F(1));color4B = ccc4BFromccc4F(color4F);color3B = ccwHITE;// in v3.0color3B color3B = color3B(0);color3B.equals(color3B(1));color4B color4B = color4B(0);color4F color4F = color4F(0);color4F = color4F(color3B);color4F = color4F(color4B);color4F.equals(color4F(1));color4B = color4B(color4F);color3B = color3B::WHITE;
继续...
| 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 |
总结

以上是内存溢出为你收集整理的cocos2dx 3.0一些变化全部内容,希望文章能够帮你解决cocos2dx 3.0一些变化所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1004610.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存