2012/06/11

cocos2d-x 1.X to 2.0


基本先看

以下列出個人在轉換途中遇到的
首先是回報的BUG

有相關需求者要注意

CCDirector::setDisplayFPS(bool) is renamed to setDisplayStats(bool)
不過他沒講的是基本上要用的話要加fps_images.fnt  &.png
可在test專案中找到
--
粒子系統
ARCH_OPTIMAL_PARTICLE_SYSTEM is should be replace to CCParticleSystemQuad,
--
CCAnimation::addFrameWithTexture -> addSpriteFrameWithTextureCCAnimation::addFrame(CCSpriteFrame*) is renamed to addSpriteFrame(CCSpriteFrame*)
--
照相
CCRednerTexture::saveBuffer(...) is modified to saveToFile(...)
要注意原本saveBuffer有overload要注意用法
--
touch->locationInView(touch->view())    touch->locationInView()    
這點我覺得很合理
--
CCProgressTimer::initWithFile(char*) and initWithTexture(CCTexture2D*) are removed, use initWithSprite(CCSprite*) instead.
setBarChangeRate(CCPoint)  如果只要X變化 設(1, 0)
setMidPoint(CCPoint)    以左邊為開始  設(0, 0.5)

CCLayerColor::layerWithColorWidthHeight is renamed to layerWithColor
CCLayerColor::initWithColorWidthHeight is renamed to initWithColor
改成overload作法
--
CCAnimate::actionWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame) method is removed, call CCAnimation::setDelayPerUnit(float) instead
注意是每一張的delay
pAnimation->setRestoreOriginalFrame

以前常用CCRepeatForever 撥重複動畫
現在用CCAnimation::setLoops(-1);
要在CCAnimate用CCAnimation初始前設定
--
CCSprite::displayedFrame() is renamed to displayFrame()
--
glColor4f    ->ccDrawColor4F
--
CCDictionary CCArray 改動過大  請詳閱文件, 基本上就是沒有mutable用法然後不用STL所以有比較快
--
以下改成由CCDirector取得
// v1.0
+ (CCScheduler*) sharedScheduler; // CCScheduler class method
+ (CCTouchDispatcher*) sharedDispatcher; // CCTouchDispatcher class method
+ (CCActionManager *) sharedManager; // CCActionManager class method
// v2.0
@property (nonatomic,readwrite,retain) CCActionManager *actionManager; // CCDirector property
@property (nonatomic,readwrite,retain) CCScheduler *scheduler; // CCDirector property
@property (nonatomic,readwrite,retain) CCTouchDispatcher * touchDispatcher; // CCDirector property (iOS)
@property (nonatomic, readwrite, retain) CCEventDispatcher* eventDispatcher; // CCDirector property (Mac)
--
win 32使用的lib (Open GL)
1.x  libgles_cm.lib    
2.0  opengl32.lib, glew32.lib  

1 則留言 :

匿名 提到...

GOOD~