In new version of cocos2d-x, it has been changed to likes bottom.
bool CCCallFunc::initWithTarget(SelectorProtocol* pSelectorTarget) {
if (pSelectorTarget)
{
dynamic_cast<CCObject*>(pSelectorTarget)->retain(); // changed line (before version use pSelectorTarget->selectorProtocolRetain();
}
if (m_pSelectorTarget)
{
dynamic_cast<CCObject*>(m_pSelectorTarget)~~>release; //
}
m_pSelectorTarget = pSelectorTarget;
return true;
}
and My function looks like,
void ActionFactory::callbackSoundAction
{
Book book = Book::sharedBook;
book->playSoundEffect;
}
CCActionActionFactory::soundObjectWithActionProperties
{
actionFactory = ActionFactory::sharedActionFactory;
std::cout<< “actionFactory retainCount :” << actionFactory~~>retainCount() << endl;
CCFiniteTimeAction soundAction = CCCallFuncND::actionWithTarget, ap);
return soundAction;
}
CCActionActionFactory::soundObjectWithActionProperties(Object object, Propertiesap)
{
actionFactory = ActionFactory::sharedActionFactory();
CCFiniteTimeAction *soundAction = CCCallFuncND::actionWithTarget(actionFactory, callfuncND_selector(ActionFactory::callbackSoundAction), ap);
return soundAction;
}
then it cause error at this line
void CCObject::retain(void)
{
CCAssert(m_uReference > 0, “reference count should greater than 0”); // here
++m_uReference;
}
It was working at version 0.9.2
Can anyone help me?
thanks