mirror of https://github.com/axmolengine/axmol.git
issue #85:remove the using of dynamic_cast()
This commit is contained in:
parent
b9587a7062
commit
39c6ebf503
|
@ -623,24 +623,32 @@ void CCDirector::end(void)
|
|||
|
||||
void CCDirector::setNextScene(void)
|
||||
{
|
||||
bool runningIsTransition = dynamic_cast<CCTransitionScene *>(m_pRunningScene) != NULL;
|
||||
bool newIsTransition = dynamic_cast<CCTransitionScene *>(m_pNextScene) != NULL;
|
||||
// bool runningIsTransition = dynamic_cast<CCTransitionScene *>(m_pRunningScene) != NULL;
|
||||
// bool newIsTransition = dynamic_cast<CCTransitionScene *>(m_pNextScene) != NULL;
|
||||
ccSceneFlag runningSceneType = ccNormalScene;
|
||||
ccSceneFlag newSceneType = m_pNextScene->getSceneType();
|
||||
|
||||
if (m_pRunningScene)
|
||||
{
|
||||
runningSceneType = m_pRunningScene->getSceneType();
|
||||
}
|
||||
|
||||
// If it is not a transition, call onExit/cleanup
|
||||
if (! newIsTransition)
|
||||
{
|
||||
if (m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->onExit();
|
||||
}
|
||||
|
||||
// issue #709. the root node (scene) should receive the cleanup message too
|
||||
// otherwise it might be leaked.
|
||||
if (m_bSendCleanupToScene && m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->cleanup();
|
||||
}
|
||||
}
|
||||
/*if (! newIsTransition)*/
|
||||
if (! (newSceneType & ccTransitionScene))
|
||||
{
|
||||
if (m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->onExit();
|
||||
}
|
||||
|
||||
// issue #709. the root node (scene) should receive the cleanup message too
|
||||
// otherwise it might be leaked.
|
||||
if (m_bSendCleanupToScene && m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pRunningScene)
|
||||
{
|
||||
|
@ -650,7 +658,8 @@ void CCDirector::setNextScene(void)
|
|||
m_pNextScene->retain();
|
||||
m_pNextScene = NULL;
|
||||
|
||||
if (! runningIsTransition && m_pRunningScene)
|
||||
/*if (! runningIsTransition && m_pRunningScene)*/
|
||||
if (! (runningSceneType & ccTransitionScene) && m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->onEnter();
|
||||
m_pRunningScene->onEnterTransitionDidFinish();
|
||||
|
|
|
@ -255,7 +255,7 @@ void CCScheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol
|
|||
{
|
||||
for (unsigned int i = 0; i < pElement->timers->num; ++i)
|
||||
{
|
||||
CCTimer *pTimer = static_cast<CCTimer*>(pElement->timers->arr[i]);
|
||||
CCTimer *pTimer = (CCTimer*)(pElement->timers->arr[i]);
|
||||
|
||||
if (pfnSelector == pTimer->m_pfnSelector)
|
||||
{
|
||||
|
@ -570,7 +570,7 @@ void CCScheduler::tick(ccTime dt)
|
|||
// The 'timers' array may change while inside this loop
|
||||
for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(elt->timerIndex))
|
||||
{
|
||||
elt->currentTimer = static_cast<CCTimer*>(elt->timers->arr[elt->timerIndex]);
|
||||
elt->currentTimer = (CCTimer*)(elt->timers->arr[elt->timerIndex]);
|
||||
elt->currentTimerSalvaged = false;
|
||||
|
||||
elt->currentTimer->update(dt);
|
||||
|
|
|
@ -400,7 +400,7 @@ void CCActionManager::update(cocos2d::ccTime dt)
|
|||
|
||||
// elt, at this moment, is still valid
|
||||
// so it is safe to ask this here (issue #490)
|
||||
elt = static_cast<tHashElement*>(elt->hh.next);
|
||||
elt = (tHashElement*)(elt->hh.next);
|
||||
|
||||
// only delete currentTarget if no actions were scheduled during the cycle (issue #481)
|
||||
if (m_bCurrentTargetSalvaged && m_pCurrentTarget->actions->num == 0)
|
||||
|
|
|
@ -69,7 +69,7 @@ NSObject* CCIntervalAction::copyWithZone(NSZone *pZone)
|
|||
if(pZone && pZone->m_pCopyObject)
|
||||
{
|
||||
//in case of being called at sub class
|
||||
pCopy = static_cast<CCIntervalAction*>(pZone->m_pCopyObject);
|
||||
pCopy = (CCIntervalAction*)(pZone->m_pCopyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -215,8 +215,8 @@ NSObject* CCSequence::copyWithZone(NSZone *pZone)
|
|||
|
||||
__super::copyWithZone(pZone);
|
||||
|
||||
pCopy->initOneTwo(static_cast<CCFiniteTimeAction*>(m_pActions[0]->copy()->autorelease()),
|
||||
static_cast<CCFiniteTimeAction*>(m_pActions[1]->copy()->autorelease()));
|
||||
pCopy->initOneTwo((CCFiniteTimeAction*)(m_pActions[0]->copy()->autorelease()),
|
||||
(CCFiniteTimeAction*)(m_pActions[1]->copy()->autorelease()));
|
||||
|
||||
CCX_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
|
@ -1365,10 +1365,12 @@ NSObject* CCFadeIn::copyWithZone(cocos2d::NSZone *pZone)
|
|||
|
||||
void CCFadeIn::update(cocos2d::ccTime time)
|
||||
{
|
||||
// because we can not use dynamic_cast(), so we cast in c style.
|
||||
// Is it sprite? can it be other node?
|
||||
/* dynamic_cast<CCRGBAProtocol*>(m_pTarget)->setOpacity((GLubyte)(255 * time));*/
|
||||
((CCSprite *)(m_pTarget))->setOpacity((GLubyte)(255 * time));
|
||||
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacity((GLubyte)(255 * time));
|
||||
}
|
||||
/*m_pTarget->setOpacity((GLubyte)(255 * time));*/
|
||||
}
|
||||
|
||||
CCIntervalAction* CCFadeIn::reverse(void)
|
||||
|
@ -1413,10 +1415,12 @@ NSObject* CCFadeOut::copyWithZone(cocos2d::NSZone *pZone)
|
|||
|
||||
void CCFadeOut::update(cocos2d::ccTime time)
|
||||
{
|
||||
// because we can not use dynamic_cast(), so we cast in c style.
|
||||
// Is it sprite? can it be other node?
|
||||
// dynamic_cast<CCRGBAProtocol*>(m_pTarget)->setOpacity(GLubyte(255 * (1 - time)));
|
||||
((CCSprite *)m_pTarget)->setOpacity((GLubyte)(255 * (1 - time)));
|
||||
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacity(GLubyte(255 * (1 - time)));
|
||||
}
|
||||
/*m_pTarget->setOpacity(GLubyte(255 * (1 - time)));*/
|
||||
}
|
||||
|
||||
CCIntervalAction* CCFadeOut::reverse(void)
|
||||
|
@ -1474,12 +1478,22 @@ void CCFadeTo::startWithTarget(CCNode *pTarget)
|
|||
{
|
||||
__super::startWithTarget(pTarget);
|
||||
|
||||
m_fromOpacity = ((CCRGBAProtocol*)(pTarget))->getOpacity();
|
||||
CCRGBAProtocol *pRGBAProtocol = pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
m_fromOpacity = pRGBAProtocol->getOpacity();
|
||||
}
|
||||
/*m_fromOpacity = pTarget->getOpacity();*/
|
||||
}
|
||||
|
||||
void CCFadeTo::update(cocos2d::ccTime time)
|
||||
{
|
||||
((CCRGBAProtocol*)(m_pTarget))->setOpacity((GLubyte)(m_fromOpacity + (m_toOpacity - m_fromOpacity) * time));
|
||||
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacity((GLubyte)(m_fromOpacity + (m_toOpacity - m_fromOpacity) * time));
|
||||
}
|
||||
/*m_pTarget->setOpacity((GLubyte)(m_fromOpacity + (m_toOpacity - m_fromOpacity) * time));*/
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1531,22 +1545,23 @@ NSObject* CCTintTo::copyWithZone(cocos2d::NSZone *pZone)
|
|||
void CCTintTo::startWithTarget(CCNode *pTarget)
|
||||
{
|
||||
__super::startWithTarget(pTarget);
|
||||
|
||||
// because we can not use dynamic_cast(), so we cast in c style.
|
||||
// Is it sprite? can it be other node?
|
||||
/*m_from = dynamic_cast<CCRGBAProtocol*>(pTarget)->getColor();*/
|
||||
m_from = ((CCSprite *)(pTarget))->getColor();
|
||||
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
m_from = pRGBAProtocol->getColor();
|
||||
}
|
||||
/*m_from = pTarget->getColor();*/
|
||||
}
|
||||
|
||||
void CCTintTo::update(cocos2d::ccTime time)
|
||||
{
|
||||
// because we can not use dynamic_cast(), so we cast in c style.
|
||||
// Is it sprite? can it be other node?
|
||||
/*CCRGBAProtocol *pTn = dynamic_cast<CCRGBAProtocol*>(m_pTarget);*/
|
||||
CCSprite *pTn = (CCSprite *)(m_pTarget);
|
||||
pTn->setColor(ccc3(GLubyte(m_from.r + (m_to.r - m_from.r) * time),
|
||||
(GLbyte)(m_from.g + (m_to.g - m_from.g) * time),
|
||||
(GLbyte)(m_from.b + (m_to.b - m_from.b) * time)));
|
||||
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setColor(ccc3(GLubyte(m_from.r + (m_to.r - m_from.r) * time),
|
||||
(GLbyte)(m_from.g + (m_to.g - m_from.g) * time),
|
||||
(GLbyte)(m_from.b + (m_to.b - m_from.b) * time)));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1602,17 +1617,25 @@ void CCTintBy::startWithTarget(CCNode *pTarget)
|
|||
{
|
||||
__super::startWithTarget(pTarget);
|
||||
|
||||
ccColor3B color = ((CCRGBAProtocol*)(pTarget))->getColor();
|
||||
m_fromR = color.r;
|
||||
m_fromG = color.g;
|
||||
m_fromB = color.b;
|
||||
CCRGBAProtocol *pRGBAProtocol = pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
ccColor3B color = pRGBAProtocol->getColor();
|
||||
m_fromR = color.r;
|
||||
m_fromG = color.g;
|
||||
m_fromB = color.b;
|
||||
}
|
||||
}
|
||||
|
||||
void CCTintBy::update(cocos2d::ccTime time)
|
||||
{
|
||||
((CCRGBAProtocol*)(m_pTarget))->setColor(ccc3((GLubyte)(m_fromR + m_deltaR * time),
|
||||
(GLubyte)(m_fromG + m_deltaG * time),
|
||||
(GLubyte)(m_fromB + m_deltaB * time)));
|
||||
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setColor(ccc3((GLubyte)(m_fromR + m_deltaR * time),
|
||||
(GLubyte)(m_fromG + m_deltaG * time),
|
||||
(GLubyte)(m_fromB + m_deltaB * time)));
|
||||
}
|
||||
}
|
||||
|
||||
CCIntervalAction* CCTintBy::reverse(void)
|
||||
|
@ -1739,7 +1762,7 @@ void CCReverseTime::update(cocos2d::ccTime time)
|
|||
|
||||
CCIntervalAction* CCReverseTime::reverse(void)
|
||||
{
|
||||
return static_cast<CCIntervalAction*>(m_pOther->copy()->autorelease());
|
||||
return (CCIntervalAction*)(m_pOther->copy()->autorelease());
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -82,15 +82,15 @@ CCAtlasNode * CCAtlasNode::initWithTileFile(const char *tile, int tileWidth, int
|
|||
void CCAtlasNode::calculateMaxItems()
|
||||
{
|
||||
CGSize s = m_pTextureAtlas->getTexture()->getContentSize();
|
||||
m_nItemsPerColumn = static_cast<int>(s.height / m_nItemHeight);
|
||||
m_nItemsPerRow = static_cast<int>(s.width / m_nItemWidth);
|
||||
m_nItemsPerColumn = (int)(s.height / m_nItemHeight);
|
||||
m_nItemsPerRow = (int)(s.width / m_nItemWidth);
|
||||
}
|
||||
|
||||
void CCAtlasNode:: calculateTexCoordsSteps()
|
||||
{
|
||||
CCTexture2D *texture = m_pTextureAtlas->getTexture();
|
||||
m_fTexStepX = m_nItemWidth / static_cast<float>(texture->getPixelsWide());
|
||||
m_fTexStepY = m_nItemHeight / static_cast<float>(texture->getPixelsHigh());
|
||||
m_fTexStepX = m_nItemWidth / (float)(texture->getPixelsWide());
|
||||
m_fTexStepY = m_nItemHeight / (float)(texture->getPixelsHigh());
|
||||
}
|
||||
|
||||
void CCAtlasNode::updateAtlasValues()
|
||||
|
|
|
@ -87,6 +87,8 @@ public:
|
|||
|
||||
virtual void draw();
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
|
||||
// CC Texture protocol
|
||||
|
||||
// returns the used texture
|
||||
|
|
|
@ -162,6 +162,8 @@ namespace cocos2d{
|
|||
// super method
|
||||
virtual void setString(const char *label);
|
||||
virtual void setAnchorPoint(CGPoint var);
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; }
|
||||
#if CC_BITMAPFONTATLAS_DEBUG_DRAW
|
||||
virtual void draw();
|
||||
#endif // CC_BITMAPFONTATLAS_DEBUG_DRAW
|
||||
|
|
|
@ -55,6 +55,8 @@ namespace cocos2d{
|
|||
* @warning Changing the string is as expensive as creating a new CCLabel. To obtain better performance use CCLabelAtlas
|
||||
*/
|
||||
virtual void setString(const char *label);
|
||||
|
||||
virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; }
|
||||
protected:
|
||||
CGSize m_tDimensions;
|
||||
UITextAlignment m_eAlignment;
|
||||
|
|
|
@ -53,6 +53,8 @@ namespace cocos2d{
|
|||
virtual void updateAtlasValues();
|
||||
virtual void setString(const char *label);
|
||||
virtual void draw();
|
||||
|
||||
virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; }
|
||||
protected:
|
||||
// string to render
|
||||
std::string m_sString;
|
||||
|
|
|
@ -130,6 +130,8 @@ public:
|
|||
/** BlendFunction. Conforms to CCBlendProtocol protocol */
|
||||
CCX_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
|
||||
private :
|
||||
void updateColor();
|
||||
};
|
||||
|
|
|
@ -90,6 +90,8 @@ namespace cocos2d{
|
|||
virtual ccColor3B getColor(void);
|
||||
virtual void setColor(ccColor3B color);
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
|
||||
private:
|
||||
CCMenuItem* itemForTouch(CCTouch * touch);
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ namespace cocos2d{
|
|||
virtual GLubyte getOpacity();
|
||||
virtual void setColor(ccColor3B color);
|
||||
virtual ccColor3B getColor();
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
protected:
|
||||
ccColor3B m_tColorBackup;
|
||||
float m_fOriginalScale;
|
||||
|
@ -189,6 +191,8 @@ namespace cocos2d{
|
|||
virtual ccColor3B getColor(){return ccBLACK;}
|
||||
virtual void setOpacity(GLubyte opacity){}
|
||||
virtual GLubyte getOpacity(){return 0;}
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
};
|
||||
|
||||
/** CCMenuItemImage accepts images as items.
|
||||
|
@ -251,6 +255,8 @@ namespace cocos2d{
|
|||
virtual void selected();
|
||||
virtual void unselected();
|
||||
virtual void setIsEnabled(bool var);
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ class CCGridBase;
|
|||
class CGPoint;
|
||||
class CCTouch;
|
||||
class CCAction;
|
||||
class CCRGBAProtocol;
|
||||
class CCLabelProtocol;
|
||||
|
||||
enum {
|
||||
kCCNodeTagInvalid = -1,
|
||||
|
@ -446,6 +448,8 @@ public:
|
|||
virtual void selectorProtocolRetain(void);
|
||||
virtual void selectorProtocolRelease(void);
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol(void) { return NULL; }
|
||||
virtual CCLabelProtocol* convertToLabelProtocol(void) { return NULL; }
|
||||
|
||||
// transformation methods
|
||||
|
||||
|
|
|
@ -40,6 +40,12 @@ additional logic.
|
|||
It is a good practice to use and CCScene as the parent of all your nodes.
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ccNormalScene = 1 << 0,
|
||||
ccTransitionScene = 1 << 1,
|
||||
} ccSceneFlag;
|
||||
|
||||
class CCX_DLL CCScene : public CCNode
|
||||
{
|
||||
public:
|
||||
|
@ -47,8 +53,11 @@ public:
|
|||
virtual ~CCScene();
|
||||
bool init();
|
||||
static CCScene *node(void);
|
||||
inline ccSceneFlag getSceneType(void) { return m_eSceneType; }
|
||||
|
||||
protected:
|
||||
ccSceneFlag m_eSceneType;
|
||||
};
|
||||
}//namespace cocos2d
|
||||
|
||||
#endif // __CCSCENE_H__
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ typedef enum {
|
|||
* - But the rendering will be slower: 1 draw per children.
|
||||
*
|
||||
*/
|
||||
class CCX_DLL CCSprite : public CCNode, public CCTextureProtocol
|
||||
class CCX_DLL CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
|
||||
{
|
||||
public:
|
||||
virtual void draw(void);
|
||||
|
@ -232,6 +232,8 @@ public:
|
|||
virtual void setIsOpacityModifyRGB(bool bValue);
|
||||
virtual bool getIsOpacityModifyRGB(void);
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol *)this; }
|
||||
|
||||
// CCTextureProtocol
|
||||
virtual void setTexture(CCTexture2D *texture);
|
||||
virtual CCTexture2D* getTexture(void);
|
||||
|
|
|
@ -416,7 +416,7 @@ namespace cocos2d{
|
|||
|
||||
CCSprite *fontChar;
|
||||
|
||||
fontChar = dynamic_cast<CCSprite*>(this->getChildByTag(i));
|
||||
fontChar = (CCSprite*)(this->getChildByTag(i));
|
||||
if( ! fontChar )
|
||||
{
|
||||
fontChar = new CCSprite();
|
||||
|
@ -488,7 +488,7 @@ namespace cocos2d{
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for(it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
(dynamic_cast<CCSprite*>(*it))->setColor(m_tColor);
|
||||
((CCSprite*)(*it))->setColor(m_tColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -505,7 +505,11 @@ namespace cocos2d{
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for(it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
(dynamic_cast<CCRGBAProtocol*>(*it))->setOpacity(m_cOpacity);
|
||||
CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacity(m_cOpacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -521,7 +525,11 @@ namespace cocos2d{
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for(it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
(dynamic_cast<CCRGBAProtocol*>(*it))->setIsOpacityModifyRGB(m_bIsOpacityModifyRGB);
|
||||
CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setIsOpacityModifyRGB(m_bIsOpacityModifyRGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,8 +107,8 @@ void CCLayer::setIsTouchEnabled(bool enabled)
|
|||
else
|
||||
{
|
||||
// have problems?
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate(static_cast<CCTargetedTouchDelegate*>(this));
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate(static_cast<CCStandardTouchDelegate*>(this));
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate((CCTargetedTouchDelegate*)(this));
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate((CCStandardTouchDelegate*)(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,8 +157,8 @@ void CCLayer::onExit()
|
|||
{
|
||||
if( m_bIsTouchEnabled )
|
||||
{
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate(static_cast<CCTargetedTouchDelegate*>(this));
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate(static_cast<CCStandardTouchDelegate*>(this));
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate((CCTargetedTouchDelegate*)(this));
|
||||
CCTouchDispatcher::getSharedDispatcher()->removeDelegate((CCStandardTouchDelegate*)(this));
|
||||
}
|
||||
/**
|
||||
if( isAccelerometerEnabled )
|
||||
|
|
|
@ -32,6 +32,7 @@ CCScene::CCScene()
|
|||
{
|
||||
m_bIsRelativeAnchorPoint = false;
|
||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||
m_eSceneType = ccNormalScene;
|
||||
}
|
||||
|
||||
CCScene::~CCScene()
|
||||
|
|
|
@ -80,6 +80,7 @@ CCTransitionScene * CCTransitionScene::initWithDuration(ccTime t, CCScene *scene
|
|||
m_pInScene->retain();
|
||||
m_pOutScene = CCDirector::getSharedDirector()->getRunningScene();
|
||||
m_pOutScene->retain();
|
||||
m_eSceneType = ccTransitionScene;
|
||||
|
||||
NSAssert( m_pInScene != m_pOutScene, "Incoming scene must be different from the outgoing scene" );
|
||||
|
||||
|
@ -229,7 +230,7 @@ void CCRotoZoomTransition:: onEnter()
|
|||
m_pInScene->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
m_pOutScene->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
|
||||
CCIntervalAction *rotozoom = static_cast<CCIntervalAction*>(CCSequence::actions
|
||||
CCIntervalAction *rotozoom = (CCIntervalAction*)(CCSequence::actions
|
||||
(
|
||||
CCSpawn::actions
|
||||
(
|
||||
|
@ -280,8 +281,8 @@ void CCJumpZoomTransition::onEnter()
|
|||
CCIntervalAction *scaleIn = CCScaleTo::actionWithDuration(m_fDuration/4, 1.0f);
|
||||
CCIntervalAction *scaleOut = CCScaleTo::actionWithDuration(m_fDuration/4, 0.5f);
|
||||
|
||||
CCIntervalAction *jumpZoomOut = dynamic_cast<CCIntervalAction*>(CCSequence::actions(scaleOut, jump, NULL));
|
||||
CCIntervalAction *jumpZoomIn = dynamic_cast<CCIntervalAction*>(CCSequence::actions(jump, scaleIn, NULL));
|
||||
CCIntervalAction *jumpZoomOut = (CCIntervalAction*)(CCSequence::actions(scaleOut, jump, NULL));
|
||||
CCIntervalAction *jumpZoomIn = (CCIntervalAction*)(CCSequence::actions(jump, scaleIn, NULL));
|
||||
|
||||
CCIntervalAction *delay = CCDelayTime::actionWithDuration(m_fDuration/2);
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ namespace cocos2d{
|
|||
|
||||
CCNode * CCMenu::addChild(CCNode * child, int zOrder, int tag)
|
||||
{
|
||||
NSAssert( dynamic_cast<CCMenuItem*>(child) != NULL, L"Menu only supports MenuItem objects as children");
|
||||
// we can not use RTTI, so we do not known the type of object
|
||||
/*NSAssert( dynamic_cast<CCMenuItem*>(child) != NULL, L"Menu only supports MenuItem objects as children");*/
|
||||
return __super::addChild(child, zOrder, tag);
|
||||
}
|
||||
|
||||
|
@ -513,8 +514,12 @@ namespace cocos2d{
|
|||
{
|
||||
break;
|
||||
}
|
||||
|
||||
dynamic_cast<CCRGBAProtocol*>(*it)->setOpacity(m_cOpacity);
|
||||
|
||||
CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacity(m_cOpacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -538,7 +543,11 @@ namespace cocos2d{
|
|||
break;
|
||||
}
|
||||
|
||||
dynamic_cast<CCRGBAProtocol*>(*it)->setColor(m_tColor);
|
||||
CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setColor(m_tColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace cocos2d{
|
|||
}
|
||||
void CCMenuItemLabel::setString(const char * label)
|
||||
{
|
||||
dynamic_cast<CCLabelProtocol*>(m_pLabel)->setString(label);
|
||||
m_pLabel->convertToLabelProtocol()->setString(label);
|
||||
this->setContentSize(m_pLabel->getContentSize());
|
||||
// [label_ setString:string];
|
||||
// [self setContentSize: [label_ contentSize]];
|
||||
|
@ -185,12 +185,12 @@ namespace cocos2d{
|
|||
{
|
||||
if(enabled == false)
|
||||
{
|
||||
m_tColorBackup = dynamic_cast<CCRGBAProtocol*>(m_pLabel)->getColor();
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pLabel)->setColor(m_tDisabledColor);
|
||||
m_tColorBackup = m_pLabel->convertToRGBAProtocol()->getColor();
|
||||
m_pLabel->convertToRGBAProtocol()->setColor(m_tDisabledColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pLabel)->setColor(m_tColorBackup);
|
||||
m_pLabel->convertToRGBAProtocol()->setColor(m_tColorBackup);
|
||||
}
|
||||
}
|
||||
__super::setIsEnabled(enabled);
|
||||
|
@ -201,19 +201,19 @@ namespace cocos2d{
|
|||
}
|
||||
void CCMenuItemLabel::setOpacity(GLubyte opacity)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pLabel)->setOpacity(opacity);
|
||||
m_pLabel->convertToRGBAProtocol()->setOpacity(opacity);
|
||||
}
|
||||
GLubyte CCMenuItemLabel::getOpacity()
|
||||
{
|
||||
return dynamic_cast<CCRGBAProtocol*>(m_pLabel)->getOpacity();
|
||||
return m_pLabel->convertToRGBAProtocol()->getOpacity();
|
||||
}
|
||||
void CCMenuItemLabel::setColor(ccColor3B color)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pLabel)->setColor(color);
|
||||
m_pLabel->convertToRGBAProtocol()->setColor(color);
|
||||
}
|
||||
ccColor3B CCMenuItemLabel::getColor()
|
||||
{
|
||||
return dynamic_cast<CCRGBAProtocol*>(m_pLabel)->getColor();
|
||||
return m_pLabel->convertToRGBAProtocol()->getColor();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -379,29 +379,31 @@ namespace cocos2d{
|
|||
//
|
||||
void CCMenuItemImage::setOpacity(GLubyte opacity)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->setOpacity(opacity);
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pSelectedImage)->setOpacity(opacity);
|
||||
m_pNormalImage->convertToRGBAProtocol()->setOpacity(opacity);
|
||||
m_pSelectedImage->convertToRGBAProtocol()->setOpacity(opacity);
|
||||
|
||||
if (m_pDisabledImage)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pDisabledImage)->setOpacity(opacity);
|
||||
{
|
||||
m_pDisabledImage->convertToRGBAProtocol()->setOpacity(opacity);
|
||||
}
|
||||
}
|
||||
void CCMenuItemImage::setColor(ccColor3B color)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->setColor(color);
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pSelectedImage)->setColor(color);
|
||||
m_pNormalImage->convertToRGBAProtocol()->setColor(color);
|
||||
m_pSelectedImage->convertToRGBAProtocol()->setColor(color);
|
||||
|
||||
if (m_pDisabledImage)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(m_pDisabledImage)->setColor(color);
|
||||
{
|
||||
m_pDisabledImage->convertToRGBAProtocol()->setColor(color);
|
||||
}
|
||||
}
|
||||
GLubyte CCMenuItemImage::getOpacity()
|
||||
{
|
||||
return dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->getOpacity();
|
||||
return m_pNormalImage->convertToRGBAProtocol()->getOpacity();
|
||||
}
|
||||
ccColor3B CCMenuItemImage::getColor()
|
||||
{
|
||||
return dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->getColor();
|
||||
return m_pNormalImage->convertToRGBAProtocol()->getColor();
|
||||
}
|
||||
CCMenuItemImage * CCMenuItemImage::itemFromNormalImage(const char *normalImage, const char *selectedImage)
|
||||
{
|
||||
|
@ -545,7 +547,7 @@ namespace cocos2d{
|
|||
NSMutableArray<CCMenuItem*>::NSMutableArrayIterator it;
|
||||
for( it = m_pSubItems->begin(); it != m_pSubItems->end(); ++it)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(*it)->setOpacity(opacity);
|
||||
(*it)->convertToRGBAProtocol()->setOpacity(opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +563,7 @@ namespace cocos2d{
|
|||
NSMutableArray<CCMenuItem*>::NSMutableArrayIterator it;
|
||||
for( it = m_pSubItems->begin(); it != m_pSubItems->end(); ++it)
|
||||
{
|
||||
dynamic_cast<CCRGBAProtocol*>(*it)->setColor(color);
|
||||
(*it)->convertToRGBAProtocol()->setColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
};
|
||||
void plist_startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
|
||||
{
|
||||
CCDictMaker *pMaker = static_cast<CCDictMaker*>(ctx);
|
||||
CCDictMaker *pMaker = (CCDictMaker*)(ctx);
|
||||
std::string sName((char*)name);
|
||||
if( sName == "dict" )
|
||||
{
|
||||
|
@ -155,21 +155,21 @@ void plist_startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
|
|||
}
|
||||
void plist_endElement(void *ctx, const xmlChar *name)
|
||||
{
|
||||
CCDictMaker * pMaker = static_cast<CCDictMaker*>(ctx);
|
||||
CCDictMaker * pMaker = (CCDictMaker*)(ctx);
|
||||
std::string sName((char*)name);
|
||||
if( sName == "dict" )
|
||||
{
|
||||
pMaker->m_tDictStack.pop();
|
||||
if ( !pMaker->m_tDictStack.empty() )
|
||||
{
|
||||
pMaker->m_pCurDict = static_cast<std::map<std::string, void*>*>(pMaker->m_tDictStack.top());
|
||||
pMaker->m_pCurDict = (std::map<std::string, void*>*)(pMaker->m_tDictStack.top());
|
||||
}
|
||||
}
|
||||
pMaker->m_tState = SAX_NONE;
|
||||
}
|
||||
void plist_characters(void *ctx, const xmlChar *ch, int len)
|
||||
{
|
||||
CCDictMaker * pMaker = static_cast<CCDictMaker*>(ctx);
|
||||
CCDictMaker * pMaker = (CCDictMaker*)(ctx);
|
||||
if (pMaker->m_tState == SAX_NONE)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -604,8 +604,8 @@ CCNode* CCSprite::addChild(CCNode *pChild, int zOrder, int tag)
|
|||
|
||||
if (m_bUsesSpriteSheet)
|
||||
{
|
||||
unsigned int index = m_pobSpriteSheet->atlasIndexForChild(static_cast<CCSprite*>(pChild), zOrder);
|
||||
m_pobSpriteSheet->insertChild(static_cast<CCSprite*>(pChild), index);
|
||||
unsigned int index = m_pobSpriteSheet->atlasIndexForChild((CCSprite*)(pChild), zOrder);
|
||||
m_pobSpriteSheet->insertChild((CCSprite*)(pChild), index);
|
||||
}
|
||||
|
||||
m_bHasChildren = true;
|
||||
|
@ -641,7 +641,7 @@ void CCSprite::removeChild(CCNode *pChild, bool bCleanup)
|
|||
{
|
||||
if (m_bUsesSpriteSheet)
|
||||
{
|
||||
m_pobSpriteSheet->removeSpriteFromAtlas(static_cast<CCSprite*>(pChild));
|
||||
m_pobSpriteSheet->removeSpriteFromAtlas((CCSprite*)(pChild));
|
||||
}
|
||||
|
||||
__super::removeChild(pChild, bCleanup);
|
||||
|
@ -656,7 +656,7 @@ void CCSprite::removeAllChildrenWithCleanup(bool bCleanup)
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator iter;
|
||||
for (iter = m_pChildren->begin(); iter != m_pChildren->end(); ++iter)
|
||||
{
|
||||
pChild = static_cast<CCSprite*>(*iter);
|
||||
pChild = (CCSprite*)(*iter);
|
||||
m_pobSpriteSheet->removeSpriteFromAtlas(pChild);
|
||||
}
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ void CCSprite::setDirtyRecursively(bool bValue)
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator iter;
|
||||
for (iter = m_pChildren->begin(); iter != m_pChildren->end(); ++iter)
|
||||
{
|
||||
pChild = static_cast<CCSprite*>(*iter);
|
||||
pChild = (CCSprite*)(*iter);
|
||||
pChild->setDirtyRecursively(true);
|
||||
}
|
||||
}
|
||||
|
@ -973,8 +973,9 @@ void CCSprite::setTexture(CCTexture2D *texture)
|
|||
// CCSprite: setTexture doesn't work when the sprite is rendered using a CCSpriteSheet
|
||||
assert(! m_bUsesSpriteSheet);
|
||||
|
||||
// // accept texture==nil as argument
|
||||
assert((! texture) || dynamic_cast<CCTexture2D*>(texture));
|
||||
// we can not use RTTI, so we do not known the type of object
|
||||
// accept texture==nil as argument
|
||||
/*assert((! texture) || dynamic_cast<CCTexture2D*>(texture));*/
|
||||
|
||||
CCX_SAFE_RELEASE(m_pobTexture);
|
||||
|
||||
|
|
|
@ -78,14 +78,14 @@ void CCSpriteFrameCache::addSpriteFramesWithDictionary(map<string, void*> *pobDi
|
|||
map<string, string*> *pMetadataMap = NULL;
|
||||
if (metadataIter != pobDictionary->end())
|
||||
{
|
||||
pMetadataMap = static_cast<map<string, string*>*>(metadataIter->second);
|
||||
pMetadataMap = (map<string, string*>*)(metadataIter->second);
|
||||
}
|
||||
|
||||
map<string, void*>::iterator framesIter = pobDictionary->find("frames");
|
||||
map<string ,void*> *pFramesMap = NULL;
|
||||
if (framesIter != pobDictionary->end())
|
||||
{
|
||||
pFramesMap = static_cast<map<string, void*>*>(framesIter->second);
|
||||
pFramesMap = (map<string, void*>*)(framesIter->second);
|
||||
}
|
||||
int format = 0;
|
||||
|
||||
|
@ -122,7 +122,7 @@ void CCSpriteFrameCache::addSpriteFramesWithDictionary(map<string, void*> *pobDi
|
|||
}
|
||||
|
||||
CCSpriteFrame *pSpriteFrame;
|
||||
pFrame = static_cast<map<string, string*>*>(frameIter->second);
|
||||
pFrame = (map<string, string*>*)(frameIter->second);
|
||||
if (format == 0)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -166,7 +166,7 @@ CCNode* CCSpriteSheet::addChild(CCNode *child, int zOrder, int tag)
|
|||
{
|
||||
assert(child != NULL);
|
||||
|
||||
CCSprite *pSprite = static_cast<CCSprite*>(child);
|
||||
CCSprite *pSprite = (CCSprite*)(child);
|
||||
// check CCSprite is using the same texture id
|
||||
assert(pSprite->getTexture()->getName() == m_pobTextureAtlas->getTexture()->getName());
|
||||
|
||||
|
@ -199,7 +199,7 @@ void CCSpriteSheet::reorderChild(CCNode *child, int zOrder)
|
|||
// override remove child
|
||||
void CCSpriteSheet::removeChild(CCNode *child, bool cleanup)
|
||||
{
|
||||
CCSprite *pSprite = static_cast<CCSprite*>(child);
|
||||
CCSprite *pSprite = (CCSprite*)(child);
|
||||
|
||||
// explicit null handling
|
||||
if (pSprite == NULL)
|
||||
|
@ -217,7 +217,7 @@ void CCSpriteSheet::removeChild(CCNode *child, bool cleanup)
|
|||
|
||||
void CCSpriteSheet::removeChildAtIndex(unsigned int uIndex, bool bDoCleanup)
|
||||
{
|
||||
removeChild(static_cast<CCSprite*>(m_pChildren->getObjectAtIndex(uIndex)), bDoCleanup);
|
||||
removeChild((CCSprite*)(m_pChildren->getObjectAtIndex(uIndex)), bDoCleanup);
|
||||
}
|
||||
|
||||
void CCSpriteSheet::removeAllChildrenWithCleanup(bool bCleanup)
|
||||
|
@ -229,7 +229,7 @@ void CCSpriteSheet::removeAllChildrenWithCleanup(bool bCleanup)
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator iter;
|
||||
for (iter = m_pChildren->begin(); iter != m_pChildren->end(); ++iter)
|
||||
{
|
||||
pSprite = static_cast<CCSprite*>(*iter);
|
||||
pSprite = (CCSprite*)(*iter);
|
||||
|
||||
if (! pSprite)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ unsigned int CCSpriteSheet::rebuildIndexInOrder(CCSprite *pobParent, unsigned in
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator iter;
|
||||
for (iter = pChildren->begin(); iter != pChildren->end(); ++iter)
|
||||
{
|
||||
pSprite = static_cast<CCSprite*>(*iter);
|
||||
pSprite = (CCSprite*)(*iter);
|
||||
|
||||
if (! pSprite)
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ unsigned int CCSpriteSheet::rebuildIndexInOrder(CCSprite *pobParent, unsigned in
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator iter;
|
||||
for (iter = pChildren->begin(); iter != pChildren->end(); ++iter)
|
||||
{
|
||||
pSprite = static_cast<CCSprite*>(*iter);
|
||||
pSprite = (CCSprite*)(*iter);
|
||||
|
||||
if (! pSprite)
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ unsigned int CCSpriteSheet::highestAtlasIndexInChild(CCSprite *pSprite)
|
|||
}
|
||||
else
|
||||
{
|
||||
return highestAtlasIndexInChild(static_cast<CCSprite*>(pChildren->getLastObject()));
|
||||
return highestAtlasIndexInChild((CCSprite*)(pChildren->getLastObject()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ unsigned int CCSpriteSheet::lowestAtlasIndexInChild(CCSprite *pSprite)
|
|||
}
|
||||
else
|
||||
{
|
||||
return lowestAtlasIndexInChild(static_cast<CCSprite*>(pChildren->getObjectAtIndex(0)));
|
||||
return lowestAtlasIndexInChild((CCSprite*)(pChildren->getObjectAtIndex(0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,11 +409,11 @@ unsigned int CCSpriteSheet::atlasIndexForChild(CCSprite *pobSprite, int nZ)
|
|||
unsigned int uChildIndex = pBrothers->getIndexOfObject(pobSprite);
|
||||
|
||||
// ignore parent Z if parent is spriteSheet
|
||||
bool bIgnoreParent = static_cast<CCSpriteSheet*>(pobSprite->getParent()) == this;
|
||||
bool bIgnoreParent = (CCSpriteSheet*)(pobSprite->getParent()) == this;
|
||||
CCSprite *pPrevious = NULL;
|
||||
if (uChildIndex > 0)
|
||||
{
|
||||
pPrevious = static_cast<CCSprite*>(pBrothers->getObjectAtIndex(uChildIndex - 1));
|
||||
pPrevious = (CCSprite*)(pBrothers->getObjectAtIndex(uChildIndex - 1));
|
||||
}
|
||||
|
||||
// first child of the sprite sheet
|
||||
|
@ -432,7 +432,7 @@ unsigned int CCSpriteSheet::atlasIndexForChild(CCSprite *pobSprite, int nZ)
|
|||
// first child of an CCSprite ?
|
||||
if (uChildIndex == 0)
|
||||
{
|
||||
CCSprite *p = static_cast<CCSprite*>(pobSprite->getParent());
|
||||
CCSprite *p = (CCSprite*)(pobSprite->getParent());
|
||||
|
||||
// less than parent and brothers
|
||||
if (nZ < 0)
|
||||
|
@ -453,7 +453,7 @@ unsigned int CCSpriteSheet::atlasIndexForChild(CCSprite *pobSprite, int nZ)
|
|||
}
|
||||
|
||||
// else (previous < 0 and sprite >= 0 )
|
||||
CCSprite *p = static_cast<CCSprite*>(pobSprite->getParent());
|
||||
CCSprite *p = (CCSprite*)(pobSprite->getParent());
|
||||
return p->getAtlasIndex() + 1;
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ void CCSpriteSheet::insertChild(CCSprite *pobSprite, unsigned int uIndex)
|
|||
CCSprite *pSprite;
|
||||
for (iterNode = pChildren->begin(); iterNode != pChildren->end(); ++iterNode)
|
||||
{
|
||||
pSprite = static_cast<CCSprite*>(*iterNode);
|
||||
pSprite = (CCSprite*)(*iterNode);
|
||||
|
||||
if (! pSprite)
|
||||
{
|
||||
|
@ -541,7 +541,7 @@ void CCSpriteSheet::removeSpriteFromAtlas(CCSprite *pobSprite)
|
|||
|
||||
for(; uIndex < count; ++uIndex)
|
||||
{
|
||||
CCSprite* s = static_cast<CCSprite*>(m_pobDescendants->getObjectAtIndex(uIndex));
|
||||
CCSprite* s = (CCSprite*)(m_pobDescendants->getObjectAtIndex(uIndex));
|
||||
s->setAtlasIndex( s->getAtlasIndex() - 1 );
|
||||
}
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ void CCSpriteSheet::removeSpriteFromAtlas(CCSprite *pobSprite)
|
|||
NSMutableArray<CCNode*>::NSMutableArrayIterator iter;
|
||||
for (iter = pChildren->begin(); iter != pChildren->end(); ++iter)
|
||||
{
|
||||
pSprite = static_cast<CCSprite*>(*iter);
|
||||
pSprite = (CCSprite*)(*iter);
|
||||
|
||||
if (! pSprite)
|
||||
{
|
||||
|
|
|
@ -162,8 +162,8 @@ CCTexture2D * CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat
|
|||
m_uPixelsWide = pixelsWide;
|
||||
m_uPixelsHigh = pixelsHigh;
|
||||
m_ePixelFormat = pixelFormat;
|
||||
m_fMaxS = contentSize.width / static_cast<float>(pixelsWide);
|
||||
m_fMaxT = contentSize.height / static_cast<float>(pixelsHigh);
|
||||
m_fMaxS = contentSize.width / (float)(pixelsWide);
|
||||
m_fMaxT = contentSize.height / (float)(pixelsHigh);
|
||||
|
||||
m_bHasPremultipliedAlpha = false;
|
||||
|
||||
|
@ -251,7 +251,7 @@ CCTexture2D * CCTexture2D::initPremultipliedATextureWithImage(UIImage *image, un
|
|||
pixelFormat = kCCTexture2DPixelFormat_A8;
|
||||
}
|
||||
|
||||
imageSize = CGSizeMake(static_cast<float>(image->width()), static_cast<float>(image->height()));
|
||||
imageSize = CGSizeMake((float)(image->width()), (float)(image->height()));
|
||||
|
||||
// Create the bitmap graphics context
|
||||
|
||||
|
@ -277,7 +277,7 @@ CCTexture2D * CCTexture2D::initPremultipliedATextureWithImage(UIImage *image, un
|
|||
// info = kCGImageAlphaOnly;
|
||||
// context = CGBitmapContextCreate(data, POTWide, POTHigh, 8, POTWide, NULL, info);
|
||||
|
||||
tempData = static_cast<void*>(image->getRGBA8888Data());
|
||||
tempData = (void*)(image->getRGBA8888Data());
|
||||
NSAssert(tempData != NULL, "NULL image data.");
|
||||
if(image->width() == POTWide && image->height() == POTHigh)
|
||||
{
|
||||
|
@ -465,7 +465,7 @@ CCTexture2D * CCTexture2D::initWithPVRTCData(const void *data, int level, int bp
|
|||
}
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, level, format, length, length, 0, size, data);
|
||||
|
||||
m_tContentSize = CGSizeMake(static_cast<float>(length), static_cast<float>(length));
|
||||
m_tContentSize = CGSizeMake((float)(length), (float)(length));
|
||||
m_uPixelsWide = length;
|
||||
m_uPixelsHigh = length;
|
||||
m_fMaxS = 1.0f;
|
||||
|
@ -495,7 +495,7 @@ CCTexture2D * CCTexture2D::initWithPVRTCFile(const char* file)
|
|||
m_uPixelsWide = pvr->getWidth(); // width
|
||||
m_uPixelsHigh = pvr->getHeight(); // height
|
||||
/// be careful : unsigned int to float
|
||||
m_tContentSize = CGSizeMake(static_cast<float>(m_uPixelsWide), static_cast<float>(m_uPixelsHigh));
|
||||
m_tContentSize = CGSizeMake((float)(m_uPixelsWide), (float)(m_uPixelsHigh));
|
||||
|
||||
pvr->release();
|
||||
|
||||
|
|
|
@ -266,13 +266,13 @@ void CCTouchDispatcher::touches(NSSet *pTouches, UIEvent *pEvent, unsigned int u
|
|||
NSSetIterator setIter;
|
||||
for (setIter = pTouches->begin(); setIter != pTouches->end(); ++setIter)
|
||||
{
|
||||
pTouch = static_cast<CCTouch *>(*setIter);
|
||||
pTouch = (CCTouch *)(*setIter);
|
||||
CCTargetedTouchHandler *pHandler;
|
||||
NSMutableArray<CCTouchHandler*>::NSMutableArrayIterator arrayIter;
|
||||
for (arrayIter = m_pTargetedHandlers->begin(); arrayIter != m_pTargetedHandlers->end(); ++arrayIter)
|
||||
/*for (unsigned int i = 0; i < m_pTargetedHandlers->num; ++i)*/
|
||||
{
|
||||
pHandler = static_cast<CCTargetedTouchHandler *>(*arrayIter);
|
||||
pHandler = (CCTargetedTouchHandler *)(*arrayIter);
|
||||
|
||||
if (! pHandler)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ void CCTouchDispatcher::touches(NSSet *pTouches, UIEvent *pEvent, unsigned int u
|
|||
CCStandardTouchHandler *pHandler;
|
||||
for (iter = m_pStandardHandlers->begin(); iter != m_pStandardHandlers->end(); ++iter)
|
||||
{
|
||||
pHandler = static_cast<CCStandardTouchHandler*>(*iter);
|
||||
pHandler = (CCStandardTouchHandler*)(*iter);
|
||||
|
||||
if (! pHandler)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue