本文整理汇总了C++中CCLabelTTF::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelTTF::getString方法的具体用法?C++ CCLabelTTF::getString怎么用?C++ CCLabelTTF::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLabelTTF
的用法示例。
在下文中一共展示了CCLabelTTF::getString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkAnswer
bool GamePan::checkAnswer(std::string pAnswer)
{
if(pAnswer.empty())
{
CCNode* pBaseNode = m_pCcbNode->getChildByTag(kTagGamePanWordPan);
CCNode* itemNode = pBaseNode->getChildByTag(kTagGamePanWordPanItemBase);
vector<string> arr = Utils::split(_answerStr);
answer = "";
for(int i = 0 ;i <arr.size();i++)
{
int id = atoi((arr.at(i).c_str()));
CCLabelTTF* text = dynamic_cast<CCLabelTTF*>(itemNode->getChildByTag(id));
answer += text->getString();
}
}
else
{
answer = pAnswer;
}
string dbResult = DBManager::sharedDBManager()->checkWordExist(answer);
if(!dbResult.empty())
{
MainGameScene* scene = dynamic_cast<MainGameScene*>(CCDirector::sharedDirector()->getRunningScene());
if(scene)
scene->openTipGame(dbResult+Utils::getPinyinLetter(Utils::getPinyinStr(dbResult)));
return true;
}
else
return false;
}
示例2: updateAndAdjust
void HRootLayer::updateAndAdjust(CCNode *node, float scaleX, float scaleY) {
CCArray *children = node->getChildren();
if (children) {
for (int i = children->count() - 1; i >= 0; --i) {
CCNode *child = (CCNode *)children->objectAtIndex(i);
if (dynamic_cast<CCLabelTTF *>(child)) {
CCLabelTTF *label = (CCLabelTTF *)child;
label->setString(HLocalizedString(label->getString()));
} else if (dynamic_cast<CCEditBox *>(child)) {
// CCEditBox *editBox = (CCEditBox *)child;
// editBox->setScaleX(scaleX);
// editBox->setScaleY(scaleY);
} else if (dynamic_cast<CCControlButton *>(child)) {
CCControlButton *button = (CCControlButton *)child;
CCString *title = button->getTitleForState(CCControlStateNormal);
button->setTitleForState(CCString::create(HLocalizedString(title->getCString())), CCControlStateNormal);
} else if (dynamic_cast<CCScrollView *>(child)) {
// CCScrollView *scrollview = (CCScrollView *)child;
// scrollview->setScaleX(scaleX);
// scrollview->setScaleY(scaleY);
updateAndAdjust(child, scaleX, scaleY);
} else {
updateAndAdjust(child, scaleX, scaleY);
}
}
}
}
示例3: JSValueMakeUndefined
JS_STATIC_FUNC_IMP(S_CCLabelTTF, jsGetString)
{
CCLabelTTF *label = (CCLabelTTF *)JSObjectGetPrivate(thisObject);
if (label) {
JSStringRef jsStr = JSStringCreateWithUTF8CString(label->getString());
JSValueRef ret = JSValueMakeString(ctx, jsStr);
JSStringRelease(jsStr);
return ret;
}
return JSValueMakeUndefined(ctx);
}
示例4: eventMenuCallback
void AccountLayer::eventMenuCallback(CCObject* pSender) {
CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
char buf[64];
int i = pMenuItem->getTag();
CCLog("DeviceId:%s", TDCCTalkingDataGA::getDeviceId());
sprintf(buf, s_EventMenuItem[i].id.c_str(), ++_indexes[i]);
CCLabelTTF* label = (CCLabelTTF*)pMenuItem->getLabel();
label->setString(buf);
switch (i) {
case CREATE_USER_ID:
mTDGAaccount = TDCCAccount::setAccount(label->getString());
break;
case ADD_LEVEL:
if (mTDGAaccount) mTDGAaccount->setLevel(_indexes[i]);
break;
case UPDATE_GAME_SERVER:
if (mTDGAaccount) mTDGAaccount->setGameServer(label->getString());
break;
case UPDATE_USER_NAME:
if (mTDGAaccount) mTDGAaccount->setAccountName(label->getString());
break;
case UPDATE_GENDER:
if (mTDGAaccount) mTDGAaccount->setGender(mTDGAaccount->kGenderMale);
break;
case UPDATE_TYPE:
if (mTDGAaccount) mTDGAaccount->setAccountType(mTDGAaccount->kAccountType1);
break;
default:
break;
}
}
示例5: update
void GamePan::update(float delta)
{
CCNode* pBaseNode = m_pCcbNode->getChildByTag(kTagGamePanWordPan);
CCNode* tabNode = pBaseNode->getChildByTag(kTagGamePanWordPanTabBase);
CCNode* itemNode = pBaseNode->getChildByTag(kTagGamePanWordPanItemBase);
vector<string> arr = Utils::split(_answerStr);
string answer;
for(int i = 0 ;i <arr.size();i++)
{
int id = atoi((arr.at(i).c_str()));
CCLabelTTF* text = dynamic_cast<CCLabelTTF*>(itemNode->getChildByTag(id));
answer += text->getString();
}
//CCLog(("############### "+answer).c_str());
}
示例6: menuSpeedCallback
void FightScene::menuSpeedCallback(CCObject* pSender)
{
CCLabelTTF *view = (CCLabelTTF *)this->getChildByTag(77);
std::string ff = std::string(view->getString());
if(def)
{
if(ff == "speed normal")
{
view->setString("speed slow");
def->setAnimationInterval(1/2.0f);
}
else
{
view->setString("speed normal");
def->setAnimationInterval(1/24.0f);
}
}
}
示例7: menuItemCallback
void TestAircraft::menuItemCallback(CCObject* menuItem)
{
CCMenuItemLabel* menuItemLabel = dynamic_cast<CCMenuItemLabel*>(menuItem);
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
if(menuItemLabel)
{
CCLabelTTF* label = dynamic_cast<CCLabelTTF*>(menuItemLabel->getLabel());
if(!label)
return;
string labelString = label->getString();
if(labelString == "straight")
{
// straight
{
Aircraft* enemy = Aircraft::createEnemyStraight();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "omni")
{
// enemy omni
{
Aircraft* omni = Aircraft::createEnemyOmni();
addChild(omni);
omni->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "ray gun")
{
// ray gun
{
Aircraft* enemy = Aircraft::createEnemyRayGun();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "tank")
{
// tank
{
Aircraft* enemy = Aircraft::createEnemyTank();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "boss00")
{
// enemy boss
Aircraft* boss = Aircraft::createBoss00();
addChild(boss);
boss->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
else if(labelString == "boss01")
{
// boss 01
{
Aircraft* enemy = Aircraft::createBoss01();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "hero")
{
Aircraft* hero = Aircraft::createHeroAircraft();
addChild(hero);
hero->setPosition(screenSize.width/2, screenSize.height/2);
GameController::sharedInstance()->setPlayerAircraft(hero);
}
}
}
示例8: tableCellTouched
void HelloWorld::tableCellTouched(cocos2d::extension::CCTableView *table, cocos2d::extension::CCTableViewCell *cell){
CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(TABLE_CELL_LABEL_TAG);
CCLog("Click item is %s",label->getString());
}