我正在使用 cocos2d-x 2.0 开发我的第一个 ios 游戏。我是这个领域的新人。我在玩模板 cocos2d-x 程序时遇到了一个奇怪的问题。也就是说,当我从 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);
我试图在 ios 模拟器中退出游戏,xcode 进入调试模式,光标停留在以下代码中的“glCear ....”行:
// 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();
}
底部窗口显示:this = (cocos2d::CCDisplayLinkDirector *)0x001dcab8
问题一直存在,直到我放回关闭菜单项代码。这是一个问题吗?