Merge pull request #1515 from dumganhar/iss1531-updateTransform

fixed #1531: The CCSprite::updateTransform() function needs to inherited from a base function on the CCNode.
This commit is contained in:
James Chen 2012-10-29 19:28:30 -07:00
commit 997b8f4079
3 changed files with 20 additions and 5 deletions

View File

@ -1124,5 +1124,12 @@ CCPoint CCNode::convertTouchToNodeSpaceAR(CCTouch *touch)
return this->convertToNodeSpaceAR(point); return this->convertToNodeSpaceAR(point);
} }
// MARMALADE ADDED
void CCNode::updateTransform()
{
// Recursively iterate over children
arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCNode*);
}
NS_CC_END NS_CC_END

View File

@ -441,6 +441,9 @@ public:
virtual void visit(void); virtual void visit(void);
// transformations // 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. */ /** performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes. */
void transform(void); void transform(void);

View File

@ -546,11 +546,16 @@ void CCSprite::updateTransform(void)
setDirty(false); setDirty(false);
} }
// MARMALADE CHANGED
// recursively iterate over children // recursively iterate over children
if( m_bHasChildren ) /* if( m_bHasChildren )
{ {
// MARMALADE: CHANGED TO USE CCNode*
// NOTE THAT WE HAVE ALSO DEFINED virtual CCNode::updateTransform()
arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*); arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*);
} }*/
CCNode::updateTransform();
#if CC_SPRITE_DEBUG_DRAW #if CC_SPRITE_DEBUG_DRAW
// draw bounding box // draw bounding box
CCPoint vertices[4] = { CCPoint vertices[4] = {