很重要的結論:
cocos2d-x
你可以在進入CCSCene 之前進行建立Sprite
但是 【刪除sprite 對象】 必須在退出CCScene 之前刪除
否則刪除 會導致CCTexture2D::~CCTexture2D() {
glDeleteTextures(1, &m_uName); // CRASH !!!
}
scheduleUpdate 為對 target 的 retainCount +1
CCCallfun 也會對target的 retainCount +1
CCSpriteBatchNode 指定texture 後,下面的Sprite 對象 的texture 必須為batchnode所指的texture.
bug on cocos2d-x
ccsequnce::create(ccaction ,....); never use this function.
schedule_selector 的select函數 的參數 一定要匹配
C++:
1.模板的分離編譯問題~
2.父類的解構函式要加virtual .以防無法調用到子類的解構函式 。
3.取消提示 > g:\ip\dev\iphone dev\cocos2d\planefps\classes\entity\enemy\vehiclegroup.h(55): 編譯類 模板 成員函數“VehicleGroup<T> *VehicleGroup<T>::buildGroup(Path *,Vector2D,int,float)”時
1> with
1> [
1> T=TTMyEnemy
1> ]
1> g:\ip\dev\iphone dev\cocos2d\planefps\classes\entity\enemy\enemygroupbuilder.h(15): 參見對正在編譯的類 模板 執行個體化“VehicleGroup<T>”的引用
1> with
1> [
1> T=TTMyEnemy
1> ]
將調用模板方法的地方放入cpp檔案 裡面
使用 C++拷貝函數 原型模式
/* C++拷貝函數 不會自動 調用基類的拷貝函數 ,而且基類的拷貝函數要重寫才能調用。 */
調用頻繁的函數 ,盡量寫成 inline 函數 。避免了頻繁的跳轉,出入踐
static 在ios 上自動析構????