FloatWord* FloatWord::create(const std::string& word,const int fontSize,Point begin){ FloatWord* ret = new FloatWord(); if(ret && ret->init(word,fontSize,begin)){ ret->autorelease(); return ret; } CC_SAFE_DELETE(ret); return nullptr; }
void GameLayer::gotoGameOver(){ GAMEDATA::getInstance()->saveHighestScore(); Size visibleSize = Director::getInstance()->getVisibleSize(); FloatWord* gameOver = FloatWord::create( "GAME OVER",40,Point(visibleSize.width,visibleSize.height/2)); this->addChild(gameOver); gameOver->floatIn(1.0f,[]{Director::getInstance()->replaceScene(MenuScene::create());}); }
FloatWord* FloatWord::create( const std::string& fonts,const int fontSize,Vec2 begin ) { FloatWord* pRet = new FloatWord(); if (pRet && pRet->init(fonts,fontSize,begin)) { pRet->autorelease(); return pRet; } else { CC_SAFE_DELETE(pRet); return nullptr; } }