Merge pull request #943 from dumganhar/gles20

fixed #1277: CCToggleVisibility should implement copyWithZone.
This commit is contained in:
James Chen 2012-05-30 01:36:13 -07:00
commit 7a32a27f1e
2 changed files with 26 additions and 5 deletions

View File

@ -103,7 +103,7 @@ CCObject* CCShow::copyWithZone(CCZone *pZone) {
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
CCFiniteTimeAction::copyWithZone(pZone); CCActionInstant::copyWithZone(pZone);
CC_SAFE_DELETE(pNewZone); CC_SAFE_DELETE(pNewZone);
return pRet; return pRet;
} }
@ -141,7 +141,7 @@ CCObject* CCHide::copyWithZone(CCZone *pZone) {
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
CCFiniteTimeAction::copyWithZone(pZone); CCActionInstant::copyWithZone(pZone);
CC_SAFE_DELETE(pNewZone); CC_SAFE_DELETE(pNewZone);
return pRet; return pRet;
} }
@ -149,21 +149,41 @@ CCObject* CCHide::copyWithZone(CCZone *pZone) {
// //
// ToggleVisibility // ToggleVisibility
// //
CCToggleVisibility * CCToggleVisibility::action() { CCToggleVisibility * CCToggleVisibility::action()
{
CCToggleVisibility *pRet = new CCToggleVisibility(); CCToggleVisibility *pRet = new CCToggleVisibility();
if (pRet) { if (pRet)
{
pRet->autorelease(); pRet->autorelease();
} }
return pRet; return pRet;
} }
void CCToggleVisibility::update(ccTime time) { void CCToggleVisibility::update(ccTime time)
{
CC_UNUSED_PARAM(time); CC_UNUSED_PARAM(time);
m_pTarget->setIsVisible(!m_pTarget->getIsVisible()); m_pTarget->setIsVisible(!m_pTarget->getIsVisible());
} }
CCObject* CCToggleVisibility::copyWithZone(CCZone *pZone)
{
CCZone *pNewZone = NULL;
CCToggleVisibility *pRet = NULL;
if (pZone && pZone->m_pCopyObject) {
pRet = (CCToggleVisibility*) (pZone->m_pCopyObject);
} else {
pRet = new CCToggleVisibility();
pZone = pNewZone = new CCZone(pRet);
}
CCActionInstant::copyWithZone(pZone);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
// //
// FlipX // FlipX
// //

View File

@ -96,6 +96,7 @@ public:
virtual ~CCToggleVisibility(){} virtual ~CCToggleVisibility(){}
//super method //super method
virtual void update(ccTime time); virtual void update(ccTime time);
virtual CCObject* copyWithZone(CCZone *pZone);
public: public:
//override static method //override static method
/** Allocates and initializes the action */ /** Allocates and initializes the action */