standwally

CCControlButton 관련 버그(Signal 11) 본문

프로그래밍/Cocos2d-x

CCControlButton 관련 버그(Signal 11)

standwally 2013. 9. 15. 17:48

CCControlButton 사용시,

일부 안드로이드 단말에서 Signal 11 에러가 발생하면서 앱이 튕기는 현상이 있다.

  • 개발 환경
  1. cocos2d-x 2.1.4
  2. android sdk 4.0.4
  3. Samsung 갤럭시 S2

 

아래 코드와 같이, CCControlButton을 create할 때, CCLabel 인스턴스를 만들어서 같이 매개변수로 전달해주지 않으면

다음 에러를 찍으면서 앱이 죽는다.

 




// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
 
    CCScale9Sprite *pScale9Sprite = CCScale9Sprite::create("CloseNormal.png", cocos2d::CCRect(0.0f, 0.0f, 256.0f, 256.0f));
 
#define CCLableTTF
#ifdef CCLableTTF 
    CCLabelTTF *pLabel = CCLabelTTF::create("Test", "Helvetica", 11);
    CCControlButton *pControlButton = CCControlButton::create(pLabel, pScale9Sprite);
#else
    CCControlButton *pControlButton = CCControlButton::create(pScale9Sprite);
#endif
    pControlButton->setPosition(ccp(100.0f, 100.0f));
 
    this->addChild(pControlButton);
     
    return true;
}