From 9f6d263c159a5f4ffd4986c81ae77a675e3d646c Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 30 Oct 2012 10:24:28 +0800 Subject: [PATCH] fixed #1531: The CCSprite::updateTransform() function needs to inherited from a base function on the CCNode. --- cocos2dx/base_nodes/CCNode.cpp | 7 +++++++ cocos2dx/base_nodes/CCNode.h | 3 +++ cocos2dx/sprite_nodes/CCSprite.cpp | 15 ++++++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index b16f1411c8..b7eb000b7a 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -1124,5 +1124,12 @@ CCPoint CCNode::convertTouchToNodeSpaceAR(CCTouch *touch) return this->convertToNodeSpaceAR(point); } +// MARMALADE ADDED +void CCNode::updateTransform() +{ + // Recursively iterate over children + arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCNode*); +} + NS_CC_END diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index 1fcb35bc27..ccd6fa0824 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -441,6 +441,9 @@ public: virtual void visit(void); // transformations + // MARMALADE ADDED THIS... SO IT IS NO LONGER SPECIFIC TO CCSprite + /** updates the quad according the the rotation, position, scale values. */ + virtual void updateTransform(void); /** performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes. */ void transform(void); diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index f77e140102..f51c261a3d 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -546,11 +546,16 @@ void CCSprite::updateTransform(void) setDirty(false); } - // recursively iterate over children - if( m_bHasChildren ) - { - arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*); - } + // MARMALADE CHANGED + // recursively iterate over children +/* if( m_bHasChildren ) + { + // MARMALADE: CHANGED TO USE CCNode* + // NOTE THAT WE HAVE ALSO DEFINED virtual CCNode::updateTransform() + arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*); + }*/ + CCNode::updateTransform(); + #if CC_SPRITE_DEBUG_DRAW // draw bounding box CCPoint vertices[4] = {