I’m trying to create a radio button menu for my Level editor. I’m using cocos2d-2.1beta3-x-2.1.0 @ Dec 05 2012. I put a break point inside the touchDownAction and found out that it is being called when I pressed the button but after that it fire up a run-time check failure. It points on this code.
void CCInvocation::invoke(CCObject* sender)
{
if (m_target && m_action)
{
(m_target~~>m_action);
}
}
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
Any help? The code below is the radiomenu I’m trying to test.
RadioMenu::RadioMenu
{
previousSelected = NULL;
}
>
CCControlButtonRadioMenu::createRadioButton
{
CCScale9Sprite buttonNormal = CCScale9Sprite::spriteWithSpriteFrameName;
CCScale9SpritebuttonSelectedButton = CCScale9Sprite::spriteWithSpriteFrameName;
>
buttonNormal~~>setPreferredSize( CCSizeMake( 40, 40 ) );
buttonSelectedButton~~>setPreferredSize );
>
CCControlButton *controlButton = CCControlButton::create;
controlButton~~>setPosition( position );
controlButton~~>setAdjustBackgroundImage;
controlButton~~>setBackgroundSpriteForState( buttonSelectedButton, CCControlStateSelected );
controlButton~~>addTargetWithActionForControlEvents, CCControlEventTouchDown );
>
return controlButton;
}
>
void RadioMenu::touchDownAction
{
if
{
previousSelected~~>setSelected(false);
}
>
sender->setSelected(true);
previousSelected= sender;
}
Thank you
Dark66