PopLayer* PopLayer::create(const string hanzi,const char* backgroundImage){ PopLayer* l = PopLayer::create(); l->setSpriteBackGround(CCSprite::create(backgroundImage)); l->setSprite9BackGround(CCScale9Sprite::create(backgroundImage)); l->setHanzi(hanzi); return l; }
PopLayer* PopLayer::create(const char* backgroundImage) { PopLayer* ml = PopLayer::create(); ml->setSpriteBackGround(Sprite::create(backgroundImage)); ml->setSprite9BackGround(Scale9Sprite::create(backgroundImage)); return ml; }
PopLayer* PopLayer::create(const Color4B& color) { PopLayer *pRet = new PopLayer(); if(pRet && pRet->initWithColor(color)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
void MainScene::keyBackClicked(){ if (CCDirector::sharedDirector()->getRunningScene()->getChildByTag(1001) == NULL) { PopLayer* exitDialog = PopLayer::create("strangedesign/Dlg_background_Appquit.png"); // exitDialog->setContentSize(CCSizeMake(winSize.width*0.8,winSize.height*0.5)); // exitDialog->setTitle("Exit",50); // exitDialog->setContentText("Are you sure to exit app!",60,100,150); exitDialog->setCallBackFunc(this,callfuncN_selector(MainScene::isExit)); exitDialog->addButton("strangedesign/Dlg_appquit_ok_button_up.png","strangedesign/Dlg_appquit_ok_button_down.png","Y",0); exitDialog->addButton("strangedesign/Dlg_appquit_cancel_button_up.png","strangedesign/Dlg_appquit_cancel_button_down.png","N",1); CCDirector::sharedDirector()->getRunningScene()->addChild(exitDialog,100,TAG_LAYER_EXIT); } }
void MazeScene::keyBackClicked() { CCPoint pos = m_Player->getPosition(); CCUserDefault::sharedUserDefault()->setDoubleForKey("xlabel", pos.x); //存x轴y轴坐标 CCUserDefault::sharedUserDefault()->setDoubleForKey("ylabel", pos.y); CCUserDefault::sharedUserDefault()->flush(); //提交 CCDirector::sharedDirector()->getKeypadDispatcher()->removeDelegate(this); PopLayer * poplayer = PopLayer::create(); poplayer->setMazeKey(this); this->addChild(poplayer); }