0

I'm using the cocos2d-x 2.0 to develop my first ios game. I'm the very new guy in this area. I encountered a weird issue when playing with the template cocos2d-x program. That is, when I removed the following codes from the HelloWorld::init(),

/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
//    you may modify it.

// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                    "CloseNormal.png",
                                    "CloseSelected.png",
                                    this,
                                    menu_selector(HelloWorld::menuCloseCallback) );
pCloseItem->setPosition( ccp(CCDirector::sharedDirector()->getWinSize().width - 20, 20) );

// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition( CCPointZero );
this->addChild(pMenu, 1);

and I tried to quit the game in ios simulator, the xcode breaks into the debug mode, the cursor stays in the 'glCear....' line in the following code:

// Draw the SCene
void CCDirector::drawScene(void)
{
    // calculate "global" dt
    calculateDeltaTime();

    //tick before glClear: issue #533
    if (! m_bPaused)
    {
       m_pScheduler->update(m_fDeltaTime);
    }

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    /* to avoid flickr, nextScene MUST be here: after tick and before draw.
     XXX: Which bug is this one. It seems that it can't be reproduced with v0.9 */
    if (m_pNextScene)
    {
        setNextScene();
    }

and the bottom window shows: this = (cocos2d::CCDisplayLinkDirector *)0x001dcab8

The problems persists until I put back the close menu item codes. Is this a problem?

4

1 に答える 1

0

iOSシミュレーターでゲームを終了するとはどういう意味ですか? 実際にゲームを完全に終了した場合、これが発生するはずなので、ここにバグはありません。これは、デバッガーが接続されている間にゲームを終了しているだけです。

余談ですが、cocos2d-x の閉じるボタンは iOS では完全に不適切です。そのようなアプリを終了することはできません。なぜ cocos2d-x の連中が iOS でそれを保持しているのかはわかりません。Apple は exit() を呼び出すアプリを承認していません。

質問が 3 か月前のものであることに気付きました!、あきらめないでください!

于 2012-11-20T18:28:56.973 に答える