From 5abb57e5f21069672ee8f1d8374dceea1761eb44 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sat, 31 Aug 2013 06:59:44 -0700 Subject: [PATCH 1/9] AddChild test fix `sortAllChildren` should not be part of the test. It is tested separatedly on another test --- .../Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index f01b8522bc..1eed2100c2 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -543,11 +543,11 @@ void AddSpriteSheet::update(float dt) { batchNode->addChild( sprites[i], zs[i], kTagBase+i); } - - batchNode->sortAllChildren(); - CC_PROFILER_STOP(this->profilerName()); + + batchNode->sortAllChildren(); + // remove them for( int i=0;i < totalToAdd;i++) { From a5e0febc3e8108ed2da3b0d8736fa344580b14d2 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sat, 31 Aug 2013 07:27:56 -0700 Subject: [PATCH 2/9] Adds better names to test And new values for get(),add(),remove(),sort(),reorder() --- .../PerformanceNodeChildrenTest.cpp | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index 1eed2100c2..394baeca34 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -296,7 +296,7 @@ void IterateSpriteSheetForLoop::update(float dt) std::string IterateSpriteSheetForLoop::title() { - return "A - Iterate SpriteSheet"; + return "Iterate SpriteSheet"; } std::string IterateSpriteSheetForLoop::subtitle() @@ -334,7 +334,7 @@ void IterateSpriteSheetCArray::update(float dt) std::string IterateSpriteSheetCArray::title() { - return "B - Iterate SpriteSheet"; + return "Iterate SpriteSheet"; } std::string IterateSpriteSheetCArray::subtitle() @@ -372,7 +372,7 @@ void IterateSpriteSheetIterator::update(float dt) std::string IterateSpriteSheetIterator::title() { - return "C - Iterate SpriteSheet"; + return "Iterate SpriteSheet"; } std::string IterateSpriteSheetIterator::subtitle() @@ -413,7 +413,7 @@ void CallFuncsSpriteSheetForEach::update(float dt) std::string CallFuncsSpriteSheetForEach::title() { - return "D - 'map' functional call"; + return "'map' functional call"; } std::string CallFuncsSpriteSheetForEach::subtitle() @@ -446,7 +446,7 @@ void CallFuncsSpriteSheetCMacro::update(float dt) std::string CallFuncsSpriteSheetCMacro::title() { - return "E - 'map' functional call"; + return "'map' functional call"; } std::string CallFuncsSpriteSheetCMacro::subtitle() @@ -521,8 +521,8 @@ void AddSpriteSheet::update(float dt) // reset seed //srandom(0); - // 15 percent - int totalToAdd = currentQuantityOfNodes * 0.15f; + // 100 percent + int totalToAdd = currentQuantityOfNodes * 1; if( totalToAdd > 0 ) { @@ -533,7 +533,7 @@ void AddSpriteSheet::update(float dt) for(int i=0; igetTexture(), Rect(0,0,32,32)); - zs[i] = CCRANDOM_MINUS1_1() * 50; + zs[i] = CCRANDOM_MINUS1_1() * 50; } // add them with random Z (very important!) @@ -561,17 +561,17 @@ void AddSpriteSheet::update(float dt) std::string AddSpriteSheet::title() { - return "F - Add to spritesheet"; + return "addChild() to spritesheet"; } std::string AddSpriteSheet::subtitle() { - return "Adds %10 of total sprites with random z. See console"; + return "Adds sprites with random z. See console"; } const char* AddSpriteSheet::testName() { - return "add sprites"; + return "addChild()"; } //////////////////////////////////////////////////////// @@ -584,8 +584,8 @@ void GetSpriteSheet::update(float dt) // reset seed //srandom(0); - // 15 percent - int totalToAdd = currentQuantityOfNodes * 0.15f; + // 100% percent + int totalToAdd = currentQuantityOfNodes * 1; if( totalToAdd > 0 ) { @@ -626,7 +626,7 @@ void GetSpriteSheet::update(float dt) std::string GetSpriteSheet::title() { - return "G - getChildByTag from spritesheet"; + return "getChildByTag from spritesheet"; } std::string GetSpriteSheet::subtitle() @@ -636,7 +636,7 @@ std::string GetSpriteSheet::subtitle() const char* GetSpriteSheet::testName() { - return "get sprites"; + return "getChildByTag()"; } @@ -649,8 +649,8 @@ void RemoveSpriteSheet::update(float dt) { //srandom(0); - // 15 percent - int totalToAdd = currentQuantityOfNodes * 0.15f; + // 100 percent + int totalToAdd = currentQuantityOfNodes * 1; if( totalToAdd > 0 ) { @@ -682,17 +682,17 @@ void RemoveSpriteSheet::update(float dt) std::string RemoveSpriteSheet::title() { - return "H - Del from spritesheet"; + return "removeChild() from spritesheet"; } std::string RemoveSpriteSheet::subtitle() { - return "Remove %10 of total sprites placed randomly. See console"; + return "Remove sprites. See console"; } const char* RemoveSpriteSheet::testName() { - return "remove sprites"; + return "removeChild()"; } //////////////////////////////////////////////////////// @@ -704,8 +704,8 @@ void ReorderSpriteSheet::update(float dt) { //srandom(0); - // 15 percent - int totalToAdd = currentQuantityOfNodes * 0.15f; + // 100 percent + int totalToAdd = currentQuantityOfNodes * 1; if( totalToAdd > 0 ) { @@ -745,17 +745,17 @@ void ReorderSpriteSheet::update(float dt) std::string ReorderSpriteSheet::title() { - return "I - Reorder from spritesheet"; + return "reorderChild() from spritesheet"; } std::string ReorderSpriteSheet::subtitle() { - return "Reorder %10 of total sprites placed randomly. See console"; + return "Reorder sprites. See console"; } const char* ReorderSpriteSheet::testName() { - return "reorder sprites"; + return "reorderChild()"; } //////////////////////////////////////////////////////// @@ -767,8 +767,8 @@ void SortAllChildrenSpriteSheet::update(float dt) { //srandom(0); - // 15 percent - int totalToAdd = currentQuantityOfNodes * 0.15f; + // 100 percent + int totalToAdd = currentQuantityOfNodes * 1; if( totalToAdd > 0 ) { @@ -810,7 +810,7 @@ void SortAllChildrenSpriteSheet::update(float dt) std::string SortAllChildrenSpriteSheet::title() { - return "J - Sort All Children from spritesheet"; + return "sortAllChildren() from spritesheet"; } std::string SortAllChildrenSpriteSheet::subtitle() @@ -820,7 +820,7 @@ std::string SortAllChildrenSpriteSheet::subtitle() const char* SortAllChildrenSpriteSheet::testName() { - return "sort all children"; + return "sortAllChildren()"; } @@ -872,7 +872,7 @@ void VisitSceneGraph::update(float dt) std::string VisitSceneGraph::title() { - return "K - Performance of visiting the scene graph"; + return "Performance of visiting the scene graph"; } std::string VisitSceneGraph::subtitle() @@ -882,7 +882,7 @@ std::string VisitSceneGraph::subtitle() const char* VisitSceneGraph::testName() { - return "visit scene graph"; + return "visit()"; } ///---------------------------------------- From 1393fb356a157022e498c4d2f61773804e5c620d Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sat, 31 Aug 2013 10:38:10 -0700 Subject: [PATCH 3/9] SpriteBatchNode: follows C++ best practices removes hungarian notation uses `int` instead of `unsigned int` Add more asserts --- cocos2dx/cocoa/CCArray.cpp | 8 +- cocos2dx/sprite_nodes/CCSprite.cpp | 6 +- cocos2dx/sprite_nodes/CCSprite.h | 2 +- cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp | 170 ++++++++++---------- cocos2dx/sprite_nodes/CCSpriteBatchNode.h | 18 +-- cocos2dx/support/data_support/ccCArray.cpp | 6 +- 6 files changed, 110 insertions(+), 100 deletions(-) diff --git a/cocos2dx/cocoa/CCArray.cpp b/cocos2dx/cocoa/CCArray.cpp index 8eaab7fa6d..3a55d6050d 100644 --- a/cocos2dx/cocoa/CCArray.cpp +++ b/cocos2dx/cocoa/CCArray.cpp @@ -107,6 +107,8 @@ Array* Array::createWithArray(Array* otherArray) Array* Array::createWithCapacity(int capacity) { + CCASSERT(capacity>=0, "Invalid capacity"); + Array* array = new Array(); if (array && array->initWithCapacity(capacity)) @@ -182,6 +184,8 @@ bool Array::initWithObjects(Object* object, ...) bool Array::initWithCapacity(int capacity) { + CCASSERT(capacity>=0, "Invalid capacity"); + data.reserve(capacity); return true; } @@ -446,6 +450,8 @@ Array* Array::createWithArray(Array* otherArray) Array* Array::createWithCapacity(int capacity) { + CCASSERT(capacity>=0, "Invalid capacity"); + Array* array = new Array(); if (array && array->initWithCapacity(capacity)) @@ -527,7 +533,7 @@ bool Array::initWithObjects(Object* object, ...) bool Array::initWithCapacity(int capacity) { - CCASSERT(!data, "Array cannot be re-initialized"); + CCASSERT(capacity>=0 && !data, "Array cannot be re-initialized"); data = ccArrayNew(capacity); return true; diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 3b4ba1c63d..de1441bc4f 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -904,7 +904,7 @@ void Sprite::updateColor(void) // renders using batch node if (_batchNode) { - if (_atlasIndex != kSpriteIndexNotInitialized) + if (_atlasIndex != INDEX_NOT_INITIALIZED) { _textureAtlas->updateQuad(&_quad, _atlasIndex); } @@ -1024,7 +1024,7 @@ void Sprite::setBatchNode(SpriteBatchNode *spriteBatchNode) // self render if( ! _batchNode ) { - _atlasIndex = kSpriteIndexNotInitialized; + _atlasIndex = INDEX_NOT_INITIALIZED; setTextureAtlas(NULL); _recursiveDirty = false; setDirty(false); @@ -1102,7 +1102,7 @@ void Sprite::setTexture(Texture2D *texture) { Image* image = new Image(); bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8); - CCAssert(isOK, "The 2x2 empty texture was created unsuccessfully."); + CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully."); texture = TextureCache::getInstance()->addUIImage(image, CC_2x2_WHITE_IMAGE_KEY); CC_SAFE_RELEASE(image); diff --git a/cocos2dx/sprite_nodes/CCSprite.h b/cocos2dx/sprite_nodes/CCSprite.h index 2acbcf28a5..20872e33a9 100644 --- a/cocos2dx/sprite_nodes/CCSprite.h +++ b/cocos2dx/sprite_nodes/CCSprite.h @@ -83,7 +83,7 @@ class CC_DLL Sprite : public NodeRGBA, public TextureProtocol { public: - static const int kSpriteIndexNotInitialized = -1; /// Sprite invalid index on the SpriteBatchNode + static const int INDEX_NOT_INITIALIZED = -1; /// Sprite invalid index on the SpriteBatchNode /// @{ /// @name Creators diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index 32e6d06e01..5401c89d3a 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -49,7 +49,7 @@ NS_CC_BEGIN * creation with Texture2D */ -SpriteBatchNode* SpriteBatchNode::createWithTexture(Texture2D* tex, int capacity/* = kDefaultSpriteBatchCapacity*/) +SpriteBatchNode* SpriteBatchNode::createWithTexture(Texture2D* tex, int capacity/* = DEFAULT_CAPACITY*/) { SpriteBatchNode *batchNode = new SpriteBatchNode(); batchNode->initWithTexture(tex, capacity); @@ -62,7 +62,7 @@ SpriteBatchNode* SpriteBatchNode::createWithTexture(Texture2D* tex, int capacity * creation with File Image */ -SpriteBatchNode* SpriteBatchNode::create(const char *fileImage, int capacity/* = kDefaultSpriteBatchCapacity*/) +SpriteBatchNode* SpriteBatchNode::create(const char *fileImage, int capacity/* = DEFAULT_CAPACITY*/) { SpriteBatchNode *batchNode = new SpriteBatchNode(); batchNode->initWithFile(fileImage, capacity); @@ -81,9 +81,9 @@ bool SpriteBatchNode::initWithTexture(Texture2D *tex, int capacity) _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; _textureAtlas = new TextureAtlas(); - if (0 == capacity) + if (capacity == 0) { - capacity = kDefaultSpriteBatchCapacity; + capacity = DEFAULT_CAPACITY; } _textureAtlas->initWithTexture(tex, capacity); @@ -175,13 +175,13 @@ void SpriteBatchNode::addChild(Node *child, int zOrder, int tag) { CCASSERT(child != NULL, "child should not be null"); CCASSERT(dynamic_cast(child) != NULL, "CCSpriteBatchNode only supports Sprites as children"); - Sprite *pSprite = (Sprite*)(child); + Sprite *sprite = static_cast(child); // check Sprite is using the same texture id - CCASSERT(pSprite->getTexture()->getName() == _textureAtlas->getTexture()->getName(), "CCSprite is not using the same texture id"); + CCASSERT(sprite->getTexture()->getName() == _textureAtlas->getTexture()->getName(), "CCSprite is not using the same texture id"); Node::addChild(child, zOrder, tag); - appendChild(pSprite); + appendChild(sprite); } void SpriteBatchNode::addChild(Node *child) @@ -212,34 +212,35 @@ void SpriteBatchNode::reorderChild(Node *child, int zOrder) // override remove child void SpriteBatchNode::removeChild(Node *child, bool cleanup) { - Sprite *pSprite = (Sprite*)(child); + Sprite *sprite = static_cast(child); // explicit null handling - if (pSprite == NULL) + if (sprite == NULL) { return; } - CCASSERT(_children->containsObject(pSprite), "sprite batch node should contain the child"); + CCASSERT(_children->containsObject(sprite), "sprite batch node should contain the child"); // cleanup before removing - removeSpriteFromAtlas(pSprite); + removeSpriteFromAtlas(sprite); - Node::removeChild(pSprite, cleanup); + Node::removeChild(sprite, cleanup); } -void SpriteBatchNode::removeChildAtIndex(unsigned int uIndex, bool bDoCleanup) +void SpriteBatchNode::removeChildAtIndex(int index, bool doCleanup) { - removeChild((Sprite*)(_children->getObjectAtIndex(uIndex)), bDoCleanup); + CCASSERT(index>=0 && index < _children->count(), "Invalid index"); + removeChild( static_cast(_children->getObjectAtIndex(index)), doCleanup); } -void SpriteBatchNode::removeAllChildrenWithCleanup(bool bCleanup) +void SpriteBatchNode::removeAllChildrenWithCleanup(bool doCleanup) { // Invalidate atlas index. issue #569 // useSelfRender should be performed on all descendants. issue #1216 arrayMakeObjectsPerformSelectorWithObject(_descendants, setBatchNode, NULL, Sprite*); - Node::removeAllChildrenWithCleanup(bCleanup); + Node::removeAllChildrenWithCleanup(doCleanup); _descendants->removeAllObjects(); _textureAtlas->removeAllQuads(); @@ -308,12 +309,12 @@ void SpriteBatchNode::sortAllChildren() int index=0; - Object* pObj = NULL; + Object* obj = NULL; //fast dispatch, give every child a new atlasIndex based on their relative zOrder (keep parent -> child relations intact) // and at the same time reorder descendants and the quads to the right index - CCARRAY_FOREACH(_children, pObj) + CCARRAY_FOREACH(_children, obj) { - Sprite* child = static_cast(pObj); + Sprite* child = static_cast(obj); updateAtlasIndex(child, &index); } } @@ -324,7 +325,7 @@ void SpriteBatchNode::sortAllChildren() void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, int* curIndex) { - unsigned int count = 0; + int count = 0; Array* array = sprite->getChildren(); if (array != NULL) { @@ -362,10 +363,10 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, int* curIndex) needNewIndex = false; } - Object* pObj = NULL; - CCARRAY_FOREACH(array,pObj) + Object* obj = NULL; + CCARRAY_FOREACH(array,obj) { - Sprite* child = static_cast(pObj); + Sprite* child = static_cast(obj); if (needNewIndex && child->getZOrder() >= 0) { oldIndex = sprite->getAtlasIndex(); @@ -397,6 +398,8 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, int* curIndex) void SpriteBatchNode::swap(int oldIndex, int newIndex) { + CCASSERT(oldIndex>=0 && oldIndex < _descendants->count() && newIndex >=0 && newIndex < _descendants->count(), "Invalid index"); + V3F_C4B_T2F_Quad* quads = _textureAtlas->getQuads(); //update the index of other swapped item @@ -438,7 +441,7 @@ void SpriteBatchNode::increaseAtlasCapacity(void) // if we're going beyond the current TextureAtlas's capacity, // all the previously initialized sprites will need to redo their texture coords // this is likely computationally expensive - unsigned int quantity = (_textureAtlas->getCapacity() + 1) * 4 / 3; + int quantity = (_textureAtlas->getCapacity() + 1) * 4 / 3; CCLOG("cocos2d: SpriteBatchNode: resizing TextureAtlas capacity from [%lu] to [%lu].", (long)_textureAtlas->getCapacity(), @@ -452,105 +455,106 @@ void SpriteBatchNode::increaseAtlasCapacity(void) } } -unsigned int SpriteBatchNode::rebuildIndexInOrder(Sprite *pobParent, unsigned int uIndex) +int SpriteBatchNode::rebuildIndexInOrder(Sprite *parent, int index) { - Array *children = pobParent->getChildren(); + CCASSERT(index>=0 && index < _children->count(), "Invalid index"); + + Array *children = parent->getChildren(); if (children && children->count() > 0) { - Object* pObject = NULL; - CCARRAY_FOREACH(children, pObject) + Object* object = NULL; + CCARRAY_FOREACH(children, object) { - Sprite* child = static_cast(pObject); + Sprite* child = static_cast(object); if (child && (child->getZOrder() < 0)) { - uIndex = rebuildIndexInOrder(child, uIndex); + index = rebuildIndexInOrder(child, index); } } } // ignore self (batch node) - if (! pobParent->isEqual(this)) + if (! parent->isEqual(this)) { - pobParent->setAtlasIndex(uIndex); - uIndex++; + parent->setAtlasIndex(index); + index++; } if (children && children->count() > 0) { - Object* pObject = NULL; - CCARRAY_FOREACH(children, pObject) + Object* object = NULL; + CCARRAY_FOREACH(children, object) { - Sprite* child = static_cast(pObject); + Sprite* child = static_cast(object); if (child && (child->getZOrder() >= 0)) { - uIndex = rebuildIndexInOrder(child, uIndex); + index = rebuildIndexInOrder(child, index); } } } - return uIndex; + return index; } -unsigned int SpriteBatchNode::highestAtlasIndexInChild(Sprite *pSprite) +int SpriteBatchNode::highestAtlasIndexInChild(Sprite *sprite) { - Array *children = pSprite->getChildren(); + Array *children = sprite->getChildren(); if (! children || children->count() == 0) { - return pSprite->getAtlasIndex(); + return sprite->getAtlasIndex(); } else { - return highestAtlasIndexInChild((Sprite*)(children->getLastObject())); + return highestAtlasIndexInChild( static_cast(children->getLastObject())); } } -unsigned int SpriteBatchNode::lowestAtlasIndexInChild(Sprite *pSprite) +int SpriteBatchNode::lowestAtlasIndexInChild(Sprite *sprite) { - Array *children = pSprite->getChildren(); + Array *children = sprite->getChildren(); if (! children || children->count() == 0) { - return pSprite->getAtlasIndex(); + return sprite->getAtlasIndex(); } else { - return lowestAtlasIndexInChild((Sprite*)(children->getObjectAtIndex(0))); + return lowestAtlasIndexInChild(static_cast(children->getObjectAtIndex(0))); } } -unsigned int SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ) +int SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ) { - Array *pBrothers = sprite->getParent()->getChildren(); - unsigned int uChildIndex = pBrothers->getIndexOfObject(sprite); + Array *siblings = sprite->getParent()->getChildren(); + int childIndex = siblings->getIndexOfObject(sprite); // ignore parent Z if parent is spriteSheet - bool bIgnoreParent = (SpriteBatchNode*)(sprite->getParent()) == this; - Sprite *pPrevious = NULL; - if (uChildIndex > 0 && - uChildIndex < UINT_MAX) + bool ignoreParent = (SpriteBatchNode*)(sprite->getParent()) == this; + Sprite *prev = NULL; + if (childIndex > 0 && childIndex != -1) { - pPrevious = (Sprite*)(pBrothers->getObjectAtIndex(uChildIndex - 1)); + prev = static_cast(siblings->getObjectAtIndex(childIndex - 1)); } // first child of the sprite sheet - if (bIgnoreParent) + if (ignoreParent) { - if (uChildIndex == 0) + if (childIndex == 0) { return 0; } - return highestAtlasIndexInChild(pPrevious) + 1; + return highestAtlasIndexInChild(prev) + 1; } // parent is a Sprite, so, it must be taken into account // first child of an Sprite ? - if (uChildIndex == 0) + if (childIndex == 0) { - Sprite *p = (Sprite*)(sprite->getParent()); + Sprite *p = static_cast(sprite->getParent()); // less than parent and brothers if (nZ < 0) @@ -565,13 +569,13 @@ unsigned int SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ) else { // previous & sprite belong to the same branch - if ((pPrevious->getZOrder() < 0 && nZ < 0) || (pPrevious->getZOrder() >= 0 && nZ >= 0)) + if ((prev->getZOrder() < 0 && nZ < 0) || (prev->getZOrder() >= 0 && nZ >= 0)) { - return highestAtlasIndexInChild(pPrevious) + 1; + return highestAtlasIndexInChild(prev) + 1; } // else (previous < 0 and sprite >= 0 ) - Sprite *p = (Sprite*)(sprite->getParent()); + Sprite *p = static_cast(sprite->getParent()); return p->getAtlasIndex() + 1; } @@ -582,37 +586,37 @@ unsigned int SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ) // add child helper -void SpriteBatchNode::insertChild(Sprite *pSprite, unsigned int uIndex) +void SpriteBatchNode::insertChild(Sprite *sprite, int index) { - pSprite->setBatchNode(this); - pSprite->setAtlasIndex(uIndex); - pSprite->setDirty(true); + sprite->setBatchNode(this); + sprite->setAtlasIndex(index); + sprite->setDirty(true); if(_textureAtlas->getTotalQuads() == _textureAtlas->getCapacity()) { increaseAtlasCapacity(); } - V3F_C4B_T2F_Quad quad = pSprite->getQuad(); - _textureAtlas->insertQuad(&quad, uIndex); + V3F_C4B_T2F_Quad quad = sprite->getQuad(); + _textureAtlas->insertQuad(&quad, index); - _descendants->insertObject(pSprite, uIndex); + _descendants->insertObject(sprite, index); // update indices - unsigned int i = uIndex+1; + int i = index+1; Sprite* child = nullptr; - for(; i<_descendants->count(); i++){ + for(; i < _descendants->count(); i++){ child = static_cast(_descendants->getObjectAtIndex(i)); child->setAtlasIndex(child->getAtlasIndex() + 1); } // add children recursively - Object* pObj = nullptr; - CCARRAY_FOREACH(pSprite->getChildren(), pObj) + Object* obj = nullptr; + CCARRAY_FOREACH(sprite->getChildren(), obj) { - child = static_cast(pObj); - unsigned int idx = atlasIndexForChild(child, child->getZOrder()); + child = static_cast(obj); + int idx = atlasIndexForChild(child, child->getZOrder()); insertChild(child, idx); } } @@ -629,7 +633,7 @@ void SpriteBatchNode::appendChild(Sprite* sprite) } _descendants->addObject(sprite); - unsigned int index=_descendants->count()-1; + int index=_descendants->count()-1; sprite->setAtlasIndex(index); @@ -638,10 +642,10 @@ void SpriteBatchNode::appendChild(Sprite* sprite) // add children recursively - Object* pObj = nullptr; - CCARRAY_FOREACH(sprite->getChildren(), pObj) + Object* obj = nullptr; + CCARRAY_FOREACH(sprite->getChildren(), obj) { - Sprite* child = static_cast(pObj); + Sprite* child = static_cast(obj); appendChild(child); } } @@ -655,7 +659,7 @@ void SpriteBatchNode::removeSpriteFromAtlas(Sprite *sprite) sprite->setBatchNode(NULL); int index = _descendants->getIndexOfObject(sprite); - if (index != UINT_MAX) + if (index != -1) { _descendants->removeObjectAtIndex(index); @@ -776,10 +780,10 @@ SpriteBatchNode * SpriteBatchNode::addSpriteWithoutQuad(Sprite*child, int z, int // XXX: optimize with a binary search int i=0; - Object* pObject = NULL; - CCARRAY_FOREACH(_descendants, pObject) + Object* object = NULL; + CCARRAY_FOREACH(_descendants, object) { - Sprite* child = static_cast(pObject); + Sprite* child = static_cast(object); if (child && (child->getAtlasIndex() >= z)) { ++i; diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.h b/cocos2dx/sprite_nodes/CCSpriteBatchNode.h index 4651fb3607..20e90d17bc 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.h +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.h @@ -61,19 +61,19 @@ class Sprite; */ class CC_DLL SpriteBatchNode : public Node, public TextureProtocol { - static const int kDefaultSpriteBatchCapacity = 29; + static const int DEFAULT_CAPACITY = 29; public: /** creates a SpriteBatchNode with a texture2d and capacity of children. The capacity will be increased in 33% in runtime if it run out of space. */ - static SpriteBatchNode* createWithTexture(Texture2D* tex, int capacity = kDefaultSpriteBatchCapacity); + static SpriteBatchNode* createWithTexture(Texture2D* tex, int capacity = DEFAULT_CAPACITY); /** creates a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children. The capacity will be increased in 33% in runtime if it run out of space. The file will be loaded using the TextureMgr. */ - static SpriteBatchNode* create(const char* fileImage, int capacity = kDefaultSpriteBatchCapacity); + static SpriteBatchNode* create(const char* fileImage, int capacity = DEFAULT_CAPACITY); SpriteBatchNode(); virtual ~SpriteBatchNode(); @@ -110,16 +110,16 @@ public: /** removes a child given a certain index. It will also cleanup the running actions depending on the cleanup parameter. @warning Removing a child from a SpriteBatchNode is very slow */ - void removeChildAtIndex(unsigned int index, bool doCleanup); + void removeChildAtIndex(int index, bool doCleanup); - void insertChild(Sprite *child, unsigned int index); + void insertChild(Sprite *child, int index); void appendChild(Sprite* sprite); void removeSpriteFromAtlas(Sprite *sprite); - unsigned int rebuildIndexInOrder(Sprite *parent, unsigned int index); - unsigned int highestAtlasIndexInChild(Sprite *sprite); - unsigned int lowestAtlasIndexInChild(Sprite *sprite); - unsigned int atlasIndexForChild(Sprite *sprite, int z); + int rebuildIndexInOrder(Sprite *parent, int index); + int highestAtlasIndexInChild(Sprite *sprite); + int lowestAtlasIndexInChild(Sprite *sprite); + int atlasIndexForChild(Sprite *sprite, int z); /* Sprites use this to start sortChildren, don't call this manually */ void reorderBatch(bool reorder); diff --git a/cocos2dx/support/data_support/ccCArray.cpp b/cocos2dx/support/data_support/ccCArray.cpp index 8caa2db075..7271675ede 100644 --- a/cocos2dx/support/data_support/ccCArray.cpp +++ b/cocos2dx/support/data_support/ccCArray.cpp @@ -72,9 +72,9 @@ void ccArrayEnsureExtraCapacity(ccArray *arr, int extra) { while (arr->max < arr->num + extra) { -// CCLOG("cocos2d: ccCArray: resizing ccArray capacity from [%lu] to [%lu].", -// (long) arr->max, -// (long) arr->max*2); + CCLOG("cocos2d: ccCArray: resizing ccArray capacity from [%lu] to [%lu].", + (long) arr->max, + (long) arr->max*2); ccArrayDoubleCapacity(arr); } From d41fdea999c94b2f65490a3f065e3f75ad6c31cc Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sat, 31 Aug 2013 15:18:28 -0700 Subject: [PATCH 4/9] objectComparisonLess -> nodeComparisonLess and unified it. No need to have 3 different copies. The only copy is in CCNode.cpp --- cocos2dx/base_nodes/CCNode.cpp | 52 ++++++++++----------- cocos2dx/base_nodes/CCNode.h | 6 +++ cocos2dx/sprite_nodes/CCSprite.cpp | 4 ++ cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp | 28 +---------- 4 files changed, 38 insertions(+), 52 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index a2c224260d..96ae1e9aa7 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -54,6 +54,30 @@ THE SOFTWARE. NS_CC_BEGIN +#if CC_USE_ARRAY_VECTOR +bool nodeComparisonLess(const RCPtr& pp1, const RCPtr& pp2) +{ + Object *p1 = static_cast(pp1); + Object *p2 = static_cast(pp2); + Node *n1 = static_cast(p1); + Node *n2 = static_cast(p2); + + return( n1->getZOrder() < n2->getZOrder() || + ( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() ) + ); +} +#else +bool nodeComparisonLess(Object* p1, Object* p2) +{ + Node *n1 = static_cast(p1); + Node *n2 = static_cast(p2); + + return( n1->getZOrder() < n2->getZOrder() || + ( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() ) + ); +} +#endif + // XXX: Yes, nodes might have a sort problem once every 15 days if the game runs at 60 FPS and each frame sprites are reordered. static int s_globalOrderOfArrival = 1; @@ -714,33 +738,9 @@ void Node::reorderChild(Node *child, int zOrder) child->_setZOrder(zOrder); } -#if CC_USE_ARRAY_VECTOR -static bool objectComparisonLess(const RCPtr& pp1, const RCPtr& pp2) -{ - Object *p1 = static_cast(pp1); - Object *p2 = static_cast(pp2); - Node *n1 = static_cast(p1); - Node *n2 = static_cast(p2); - - return( n1->getZOrder() < n2->getZOrder() || - ( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() ) - ); -} -#else -static bool objectComparisonLess(Object* p1, Object* p2) -{ - Node *n1 = static_cast(p1); - Node *n2 = static_cast(p2); - - return( n1->getZOrder() < n2->getZOrder() || - ( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() ) - ); -} -#endif - void Node::sortAllChildren() { -#if 0 +#if 1 if (_reorderChildDirty) { int i,j,length = _children->count(); @@ -769,7 +769,7 @@ void Node::sortAllChildren() } #else if( _reorderChildDirty ) { - std::sort( std::begin(*_children), std::end(*_children), objectComparisonLess ); + std::sort( std::begin(*_children), std::end(*_children), nodeComparisonLess ); _reorderChildDirty = false; } #endif diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index f4ad8940a1..60c9f0ee11 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -66,6 +66,12 @@ enum { kNodeOnCleanup }; +#if CC_USE_ARRAY_VECTOR +bool nodeComparisonLess(const RCPtr& pp1, const RCPtr& pp2); +#else +bool nodeComparisonLess(Object* p1, Object* p2); +#endif + /** @brief Node is the main element. Anything that gets drawn or contains things that get drawn is a Node. The most popular Nodes are: Scene, Layer, Sprite, Menu. diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 3b4ba1c63d..2d357726ed 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -693,6 +693,7 @@ void Sprite::sortAllChildren() { if (_reorderChildDirty) { +#if 0 int i = 0, j = 0, length = _children->count(); // insertion sort @@ -714,6 +715,9 @@ void Sprite::sortAllChildren() } _children->fastSetObject(tempI, j+1); } +#else + std::sort(std::begin(*_children), std::end(*_children), nodeComparisonLess); +#endif if ( _batchNode) { diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index 32e6d06e01..5185b92d7a 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -245,36 +245,12 @@ void SpriteBatchNode::removeAllChildrenWithCleanup(bool bCleanup) _textureAtlas->removeAllQuads(); } -#if CC_USE_ARRAY_VECTOR -static bool objectComparisonLess(const RCPtr& pp1, const RCPtr& pp2) -{ - Object *p1 = static_cast(pp1); - Object *p2 = static_cast(pp2); - Node *n1 = static_cast(p1); - Node *n2 = static_cast(p2); - - return( n1->getZOrder() < n2->getZOrder() || - ( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() ) - ); -} -#else -static bool objectComparisonLess(Object* p1, Object* p2) -{ - Node *n1 = static_cast(p1); - Node *n2 = static_cast(p2); - - return( n1->getZOrder() < n2->getZOrder() || - ( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() ) - ); -} -#endif - //override sortAllChildren void SpriteBatchNode::sortAllChildren() { if (_reorderChildDirty) { -#if 0 +#if 1 int i = 0,j = 0,length = _children->count(); // insertion sort @@ -297,7 +273,7 @@ void SpriteBatchNode::sortAllChildren() _children->fastSetObject(tempI, j+1); } #else - std::sort(std::begin(*_children), std::end(*_children), objectComparisonLess); + std::sort(std::begin(*_children), std::end(*_children), nodeComparisonLess); #endif //sorted now check all children From b697e2bc994b65f88e993eb86a1b52fcf73cc869 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sat, 31 Aug 2013 15:37:35 -0700 Subject: [PATCH 5/9] uses std::sort() by default --- cocos2dx/base_nodes/CCNode.cpp | 2 +- cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 96ae1e9aa7..ef111dfbce 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -740,7 +740,7 @@ void Node::reorderChild(Node *child, int zOrder) void Node::sortAllChildren() { -#if 1 +#if 0 if (_reorderChildDirty) { int i,j,length = _children->count(); diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index 5185b92d7a..f38c8b6fae 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -250,7 +250,7 @@ void SpriteBatchNode::sortAllChildren() { if (_reorderChildDirty) { -#if 1 +#if 0 int i = 0,j = 0,length = _children->count(); // insertion sort From 0d96a0ce4040085ec1d1f50868da697865e5a3ca Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sat, 31 Aug 2013 15:49:25 -0700 Subject: [PATCH 6/9] resets random seed before each test --- .../Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index 394baeca34..259611cb8f 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -151,6 +151,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) updateQuantityOfNodes(); updateProfilerName(); CC_PROFILER_PURGE_ALL(); + srandom(0); }); decrease->setColor(Color3B(0,200,20)); auto increase = MenuItemFont::create(" + ", [&](Object *sender) { @@ -162,6 +163,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) updateQuantityOfNodes(); updateProfilerName(); CC_PROFILER_PURGE_ALL(); + srandom(0); }); increase->setColor(Color3B(0,200,20)); @@ -182,6 +184,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) updateQuantityLabel(); updateQuantityOfNodes(); updateProfilerName(); + srandom(0); } std::string NodeChildrenMainScene::title() From be0c8cb1e809f4d1ec32da470261d7c19416d3fe Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sat, 31 Aug 2013 17:08:51 -0700 Subject: [PATCH 7/9] adds two more perf tests Node::addChild and Node::removeChild --- .../PerformanceNodeChildrenTest.cpp | 138 ++++++++++++++++-- .../PerformanceNodeChildrenTest.h | 20 +++ 2 files changed, 149 insertions(+), 9 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index 259611cb8f..570a72463d 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -38,8 +38,10 @@ static std::function createFunctions[] = CL(CallFuncsSpriteSheetForEach), CL(CallFuncsSpriteSheetCMacro), + CL(AddSprite), CL(AddSpriteSheet), CL(GetSpriteSheet), + CL(RemoveSprite), CL(RemoveSpriteSheet), CL(ReorderSpriteSheet), CL(SortAllChildrenSpriteSheet), @@ -514,6 +516,69 @@ const char* AddRemoveSpriteSheet::testName() return "none"; } +//////////////////////////////////////////////////////// +// +// AddSprite +// +//////////////////////////////////////////////////////// +void AddSprite::update(float dt) +{ + // reset seed + //srandom(0); + + // 100 percent + int totalToAdd = currentQuantityOfNodes * 1; + + if( totalToAdd > 0 ) + { + Sprite **sprites = new Sprite*[totalToAdd]; + int *zs = new int[totalToAdd]; + + // Don't include the sprite creation time and random as part of the profiling + for(int i=0; igetTexture(), Rect(0,0,32,32)); + zs[i] = CCRANDOM_MINUS1_1() * 50; + } + + // add them with random Z (very important!) + CC_PROFILER_START( this->profilerName() ); + + for( int i=0; i < totalToAdd;i++ ) + { + this->addChild( sprites[i], zs[i], kTagBase+i); + } + CC_PROFILER_STOP(this->profilerName()); + + + batchNode->sortAllChildren(); + + // remove them + for( int i=0;i < totalToAdd;i++) + { + this->removeChild( sprites[i], true); + } + + delete [] sprites; + delete [] zs; + } +} + +std::string AddSprite::title() +{ + return "Node::addChild()"; +} + +std::string AddSprite::subtitle() +{ + return "Adds sprites with random z. See console"; +} + +const char* AddSprite::testName() +{ + return "Node::addChild()"; +} + //////////////////////////////////////////////////////// // // AddSpriteSheet @@ -564,7 +629,7 @@ void AddSpriteSheet::update(float dt) std::string AddSpriteSheet::title() { - return "addChild() to spritesheet"; + return "SpriteBatchNode::addChild()"; } std::string AddSpriteSheet::subtitle() @@ -574,7 +639,7 @@ std::string AddSpriteSheet::subtitle() const char* AddSpriteSheet::testName() { - return "addChild()"; + return "SpriteBatchNode::addChild()"; } //////////////////////////////////////////////////////// @@ -639,10 +704,65 @@ std::string GetSpriteSheet::subtitle() const char* GetSpriteSheet::testName() { - return "getChildByTag()"; + return "SpriteBatchNode::getChildByTag()"; } +//////////////////////////////////////////////////////// +// +// RemoveSprite +// +//////////////////////////////////////////////////////// +void RemoveSprite::update(float dt) +{ + //srandom(0); + + // 100 percent + int totalToAdd = currentQuantityOfNodes * 1; + + if( totalToAdd > 0 ) + { + Sprite **sprites = new Sprite*[totalToAdd]; + + // Don't include the sprite creation time as part of the profiling + for(int i=0;igetTexture(), Rect(0,0,32,32)); + } + + // add them with random Z (very important!) + for( int i=0; i < totalToAdd;i++ ) + { + this->addChild( sprites[i], CCRANDOM_MINUS1_1() * 50, kTagBase+i); + } + + // remove them + CC_PROFILER_START( this->profilerName() ); + for( int i=0;i < totalToAdd;i++) + { + this->removeChild( sprites[i], true); + } + CC_PROFILER_STOP( this->profilerName() ); + + delete [] sprites; + } +} + +std::string RemoveSprite::title() +{ + return "Node::removeChild()"; +} + +std::string RemoveSprite::subtitle() +{ + return "Remove sprites. See console"; +} + +const char* RemoveSprite::testName() +{ + return "Node::removeChild()"; +} + //////////////////////////////////////////////////////// // // RemoveSpriteSheet @@ -685,7 +805,7 @@ void RemoveSpriteSheet::update(float dt) std::string RemoveSpriteSheet::title() { - return "removeChild() from spritesheet"; + return "SpriteBatchNode::removeChild()"; } std::string RemoveSpriteSheet::subtitle() @@ -695,7 +815,7 @@ std::string RemoveSpriteSheet::subtitle() const char* RemoveSpriteSheet::testName() { - return "removeChild()"; + return "SpriteBatchNode::removeChild()"; } //////////////////////////////////////////////////////// @@ -748,7 +868,7 @@ void ReorderSpriteSheet::update(float dt) std::string ReorderSpriteSheet::title() { - return "reorderChild() from spritesheet"; + return "SpriteBatchNode::reorderChild()"; } std::string ReorderSpriteSheet::subtitle() @@ -758,7 +878,7 @@ std::string ReorderSpriteSheet::subtitle() const char* ReorderSpriteSheet::testName() { - return "reorderChild()"; + return "SpriteBatchNode::reorderChild()"; } //////////////////////////////////////////////////////// @@ -813,7 +933,7 @@ void SortAllChildrenSpriteSheet::update(float dt) std::string SortAllChildrenSpriteSheet::title() { - return "sortAllChildren() from spritesheet"; + return "SpriteBatchNode::sortAllChildren()"; } std::string SortAllChildrenSpriteSheet::subtitle() @@ -823,7 +943,7 @@ std::string SortAllChildrenSpriteSheet::subtitle() const char* SortAllChildrenSpriteSheet::testName() { - return "sortAllChildren()"; + return "SpriteBatchNode::sortAllChildren()"; } diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.h b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.h index 2ace1e38ac..7c6a1efea4 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.h +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceNodeChildrenTest.h @@ -125,6 +125,16 @@ public: /// +class AddSprite : public AddRemoveSpriteSheet +{ +public: + virtual void update(float dt); + + virtual std::string title(); + virtual std::string subtitle(); + virtual const char* testName(); +}; + class AddSpriteSheet : public AddRemoveSpriteSheet { public: @@ -145,6 +155,16 @@ public: virtual const char* testName(); }; +class RemoveSprite : public AddRemoveSpriteSheet +{ +public: + virtual void update(float dt); + + virtual std::string title(); + virtual std::string subtitle(); + virtual const char* testName(); +}; + class RemoveSpriteSheet : public AddRemoveSpriteSheet { public: From 2c6665ac3bf280ec64fde2404f92e6668f2d340d Mon Sep 17 00:00:00 2001 From: minggo Date: Sun, 1 Sep 2013 22:41:11 +0800 Subject: [PATCH 8/9] add missing head --- cocos2dx/sprite_nodes/CCSprite.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 2d357726ed..2fe5ca8cb7 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -25,6 +25,8 @@ THE SOFTWARE. ****************************************************************************/ #include "CCSpriteBatchNode.h" +#include +#include #include "CCAnimation.h" #include "CCAnimationCache.h" #include "ccConfig.h" @@ -44,7 +46,7 @@ THE SOFTWARE. #include "support/CCProfiling.h" // external #include "kazmath/GL/matrix.h" -#include + using namespace std; From 115debd953380846130c9bb97ea25b5b39e7f95a Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Sun, 1 Sep 2013 15:17:40 +0000 Subject: [PATCH 9/9] [AUTO] : updating submodule reference to latest autogenerated bindings --- scripting/auto-generated | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/auto-generated b/scripting/auto-generated index c5fc9f2b3d..567e5d2612 160000 --- a/scripting/auto-generated +++ b/scripting/auto-generated @@ -1 +1 @@ -Subproject commit c5fc9f2b3d9ae1e092b611e8969e8c2098d40711 +Subproject commit 567e5d2612fc564464ccde9ba3da7cfdbc44880f