本文整理汇总了C++中TextNode::setTag方法的典型用法代码示例。如果您正苦于以下问题:C++ TextNode::setTag方法的具体用法?C++ TextNode::setTag怎么用?C++ TextNode::setTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextNode
的用法示例。
在下文中一共展示了TextNode::setTag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTitleSprite
void TitleBar::setTitleSprite(const char *name)
{
removePreTitle();
CCSprite *titleSp = CCSprite::spriteWithSpriteFrameName(name);
if(strlen(name)==0)
return;
if (!titleSp) {
titleSp = CCSprite::spriteWithFile(name);
}
if(titleSp)
{
titleSp->setPosition(ccp(58, 45));
titleSp->setAnchorPoint(ccp(0, 0.5));
addChild(titleSp);
titleSp->setTag(kTitleBarSprite);
}
else {
TextNode* titleLabel = TextNode::textWithString(name,
CCSizeMake(300, 40),
CCTextAlignmentLeft,
40);
titleLabel->setAnchorPoint(CCPointMake(0.0, 0.5));
titleLabel->setPosition(CCPointMake(60, 45));
titleLabel->setShadowColor(ccBLACK);
addChild(titleLabel);
titleLabel->setTag(kTitleBarLabel);
}
}
示例2: setTitleString
void TitleBar::setTitleString(const char* str)
{
removePreTitle();
TextNode* titleLabel = TextNode::textWithString(str, CCSizeMake(300, 40), CCTextAlignmentLeft, 40);
titleLabel->setShadowColor(ccBLACK);
titleLabel->setAnchorPoint(CCPointMake(0.0, 0.5));
titleLabel->setPosition(CCPointMake(60, 45));
addChild(titleLabel);
titleLabel->setTag(kTitleBarLabel);
}
示例3: initBtn
//******************************************************************************
// initBtn
//******************************************************************************
void CommDlg::initBtn()
{
char buf[100];
//如果还未登录,只显示一个按钮,即要求一定要重试, //付费失败必须重试
if( ((m_iRc == kReqConnectErr) || (m_iRc == 100) || (m_iRc == 401))
&& ((CGameData::Inst()->chkLogin() == false) || (CGameData::Inst()->isPaying() ))){
//ok
CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
if(sp){
sp->setPosition(CCPointMake(0, -78));
addChild(sp, 0, kCommBtnTagOk);
}
snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("sureTip"));
TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
lbText->setPosition(CCPointMake(-4, -74));
lbText->setColor(ccWHITE);
lbText->setShadowColor(ccBLACK);
addChild(lbText, 1);
lbText->setTag(kCommTextTagOk);
}
else if((m_iRc == kReqConnectErr) || (m_iRc == 100) || (m_iRc == 401)){
//ok
CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
if(sp){
sp->setPosition(CCPointMake(-104, -78));
addChild(sp, 0, kCommBtnTagOk);
}
snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("sureTip"));
TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
lbText->setPosition(CCPointMake(-108, -74));
lbText->setColor(ccWHITE);
lbText->setShadowColor(ccBLACK);
addChild(lbText, 1);
lbText->setTag(kCommTextTagOk);
//cancel
sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
if(sp){
sp->setPosition(CCPointMake(104, -78));
addChild(sp, 0, kCommBtnTagCancel);
}
snprintf(buf, 99, "%s", CGameData::Inst()->getLanguageValue("cancelTip"));
lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
lbText->setPosition(CCPointMake(100, -74));
lbText->setColor(ccWHITE);
lbText->setShadowColor(ccBLACK);
addChild(lbText, 1);
lbText->setTag(kCommTextTagCancel);
}
else if((m_iRc == 502) || (HttpComm::Inst()->getMaintenance() != 0)){
//ok
CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
if(sp){
sp->setPosition(CCPointMake(0, -78));
addChild(sp, 0, kCommBtnTagOk);
}
snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("sureTip"));
TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
lbText->setPosition(CCPointMake(-4, -74));
lbText->setColor(ccWHITE);
lbText->setShadowColor(ccBLACK);
addChild(lbText, 1);
lbText->setTag(kCommTextTagOk);
}
//服务器返回的提示,无需重试,仅显示取消按钮(文字显示为确定)
else{
const char* errMsg = CGameData::Inst()->getErrMsg();
if(errMsg != NULL){
string eMsg = errMsg;
if (eMsg.find("武将不存在")!=string::npos) {
//ok
CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
if(sp){
sp->setPosition(CCPointMake(-104, -78));
addChild(sp, 0, kCommBtnTagOk);
}
snprintf(buf, 99, "%s", CGameData::Inst()->getLanguageValue("re_login"));
TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
lbText->setPosition(CCPointMake(-108, -74));
lbText->setColor(ccWHITE);
lbText->setShadowColor(ccBLACK);
addChild(lbText, 1);
lbText->setTag(kCommTextTagOk);
//cancel
sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
if(sp){
sp->setPosition(CCPointMake(104, -78));
addChild(sp, 0, kCommBtnTagCancel);
}
snprintf(buf, 99, "%s", CGameData::Inst()->getLanguageValue("cancelTip"));
//.........这里部分代码省略.........