当前位置: 首页>>代码示例>>C++>>正文


C++ CLabel类代码示例

本文整理汇总了C++中CLabel的典型用法代码示例。如果您正苦于以下问题:C++ CLabel类的具体用法?C++ CLabel怎么用?C++ CLabel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CLabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getItemSprite

void CHeroExpItem::showItem(CItem* item)
{
	const ItemData * itemData = DataCenter::sharedData()->getItemDesc()->getCfg(item->itemId);

	CImageView *itembg1 = (CImageView *)(m_ui->findWidgetById("itembg1"));
	CImageView *mask1 = (CImageView *)(m_ui->findWidgetById("mask1"));
	mask1->setTexture(setItemQualityTexture(item->quality));

	CCSprite *head = getItemSprite(item);
	if (!head)
	{
		head = CCSprite::create("prop/32003.png");
		CCLOG("[ ERROR ] CHeroExpItem::showItem Lost Image = %d",item->iconId);
	}
	if (head)
	{
		head->setScale(82.0f/100.0f);
		head->setPosition(ccp(itembg1->getContentSize().width/2, itembg1->getContentSize().height/2));
		itembg1->addChild(head);
	}

	CLabel *name = (CLabel *)(m_ui->findWidgetById("name"));
	if(itemData)
	{
		name->setString(itemData->itemName.c_str());
	}

	CLabel *num = (CLabel *)(m_ui->findWidgetById("num"));
	num->setString(ToString(item->itemNum));
}
开发者ID:54993306,项目名称:Classes,代码行数:30,代码来源:HeroExpItem.cpp

示例2: updateData

void CHeroEvolveEffectLayer::updateData( )
{
	//面板数据
	int iValue[][2] = { 
		{m_pBaseHero->combat, m_pAimHero->combat}, 
		{m_pBaseHero->hp, m_pAimHero->hp}, 
		{m_pBaseHero->atk, m_pAimHero->atk}, 
		{m_pBaseHero->def, m_pAimHero->def},
		{m_pBaseHero->dex, m_pAimHero->dex}, 
		{m_pBaseHero->hit, m_pAimHero->hit}, 
		{m_pBaseHero->crit, m_pAimHero->crit}, 
		{m_pBaseHero->dodge, m_pAimHero->dodge},
		{m_pBaseHero->renew, m_pAimHero->renew}
	};

	//更新数据
	for(int i=0; i<9; i++)
	{
		CLayout *pLay = (CLayout *)m_pUI->findWidgetById(CCString::createWithFormat("data%d", i+1)->getCString());
		pLay->setVisible(false);
		CLabel *pBaseValue = (CLabel *)pLay->findWidgetById(CCString::createWithFormat("base_value%d", i+1)->getCString());
		pBaseValue->setString(ToString(iValue[i][0]));
		CLabel *pAimValue = (CLabel *)pLay->findWidgetById(CCString::createWithFormat("aim_value%d", i+1)->getCString());
		pAimValue->setString(ToString(iValue[i][1]));
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:26,代码来源:HeroEvolveEffectLayer.cpp

示例3: CreateLabel

CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name)
{
    CLabel* pc = CreateControl<CLabel>(pos, dim, icon, eventMsg);
    if (pc != nullptr)
        pc->SetName(name);
    return pc;
}
开发者ID:2asoft,项目名称:colobot,代码行数:7,代码来源:interface.cpp

示例4: InputBox

std::string InputBox(const std::string &msg, const std::string &init, int max, chtype out)
{
    CDialog *dialog = CreateBaseDialog(TColorPair(COLOR_GREEN, COLOR_BLUE),
                                       TColorPair(COLOR_WHITE, COLOR_BLUE), 50);
    
    CLabel *label = new CLabel(msg, false);
    label->SetMaxReqWidth(MaxW());
    dialog->AddWidget(label);
    
    CInputField *input = new CInputField(init, CInputField::STRING, max, out);
    dialog->StartPack(input, true, true, 1, 0);
    
    CButton *okbutton = new CButton(GetTranslation("OK")), *cancelbutton = new CButton(GetTranslation("Cancel"));
    dialog->AddButton(okbutton, false, false);
    dialog->AddButton(cancelbutton, false, false);

    TUI.AddGroup(dialog, true);
    
    while (dialog->Run())
        ;
    
    std::string ret;
    if (dialog->ActivatedWidget() != cancelbutton)
        ret = input->Value();
    
    delete dialog;
    
    return ret;
}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:29,代码来源:dialogs.cpp

示例5: ccw_click_selector

void CHeroExpItem::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
	CLayout *lay = UICloneMgr::cloneLayout(m_cell);

	const CEvolQuest &evol = m_evolInfo.questsList.at(uIdx);
	const TaskData *task = DataCenter::sharedData()->getTask(Evole_Task)->getCfg(evol.id);
	for (int i = 1; i <=4; i++)
	{
		CCNode *child = lay->getChildByTag(i);
		lay->removeChild(child);
		pCell->addChild(child);

		if (i==1)
		{
			CImageView *bgView= (CImageView*)child;
			bgView->setTouchEnabled(true);
		    bgView->setUserData(&m_evolInfo.questsList.at(uIdx));
			bgView->setOnClickListener(this, ccw_click_selector(CHeroExpItem::onRecvTask));
		}
		else if (i==2)
		{
			CLabel *taskName = (CLabel*)child;
			taskName->setString(task->taskName.c_str());
		}
		else if (i==3)
		{
			CLabel *taskDesc = (CLabel*)child;
			taskDesc->setString(task->taskDesc.c_str());
		}
		else if (i==4)
		{
			child->setVisible(evol.pass);
		}
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:35,代码来源:HeroExpItem.cpp

示例6: updateSelectCity

void CCommandLayer::updateSelectCity(CCity *data)
{
	CCSprite *build = (CCSprite*)(m_comLayer->findWidgetById("build"));
    CCTexture2D *textTure = CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("command/%d.jpg",data->cityId*10+1)->getCString());
	if (textTure)
	{
		build->setTexture(textTure);
	}

	CLabel *food = (CLabel*)(m_comLayer->findWidgetById("food"));
	food->setString(ToString(data->lvFood));

	CLabel *heronum = (CLabel*)(m_comLayer->findWidgetById("heronum"));
	heronum->setString(CCString::createWithFormat("%d/%d",data->haveHeroNum,data->heroNum)->getCString());

	CLabel *note1 = (CLabel*)(m_comLayer->findWidgetById("func1"));

	CLabel *note2 = (CLabel*)(m_comLayer->findWidgetById("func2"));

    CCArray *strArr = strSplit(data->note.c_str(),"|");
	
	if (strArr->count()==1)
	{
		note1->setString(((CCString*)strArr->objectAtIndex(0))->getCString());
		note2->setString("");
	}
	else if (strArr->count()==2)
	{
		note1->setString(((CCString*)strArr->objectAtIndex(0))->getCString());
		note2->setString(((CCString*)strArr->objectAtIndex(1))->getCString());
	}

	CButton *command = (CButton*)(m_comLayer->findWidgetById("strengthen"));

	UserData *user = DataCenter::sharedData()->getUser()->getUserData();
	if (data->cityId != m_commandData.cityInfo.cityId)
	{
		if (user->getRoleFood()>=data->lvFood&&data->level< m_commandData.cityInfo.level)
		{
			command->setEnabled(true);
		}
		else
		{
			command->setEnabled(false);
		}
	}
	else
	{
		if (user->getRoleFood()>=data->lvFood)
		{
			command->setEnabled(true);
		}
		else
		{
			command->setEnabled(false);
		}
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:58,代码来源:CommandLayer.cpp

示例7: setTitle

bool CExpandableListViewBasicTest::init()
{
	CExpandableListViewTestSceneBase::init();
	setTitle("CExpandableListViewBasicTest");
	setDescription("click item to expand");
	
	pListView = CExpandableListView::create(CCSize(320, 390));
	pListView->setBackgroundImage("background2.png");
	pListView->setPosition(CCPoint(480, 320));
	m_pWindow->addChild(pListView);

	for( int i = 0; i < 10; i++ )
	{
		CExpandableNode* pExpandableNode = CExpandableNode::create();
		pExpandableNode->setContentSize(CCSize(320, 50));
		pListView->insertExpandableNodeAtLast(pExpandableNode);

		CImageViewScale9* pExpandableNodeBg = CImageViewScale9::create(CCSize(320, 45), "expandnodebg.png");
		pExpandableNodeBg->setPosition(CCPoint(320/2, 50/2));
		pExpandableNode->addChild(pExpandableNodeBg);

		CButton* pColBtn = CButton::createWith9Sprite(CCSize(35, 35), "sprite9_btn1.png", "sprite9_btn2.png");
		pColBtn->setPosition(ccp(320 - 30, 50 / 2));
		pColBtn->setText("-");
		pColBtn->setUserTag(i);
		pColBtn->setOnClickListener(this, ccw_click_selector(CExpandableListViewBasicTest::onClick));
		pExpandableNode->addChild(pColBtn);

		char buff[64] = {0};
		sprintf(buff, "ExpandableNode : %d", i);
		CLabel* pTitleLabel = CLabel::create(buff, "", 28);
		pTitleLabel->setPosition(CCPoint(10, 50/2));
		pTitleLabel->setAnchorPoint(CCPoint(0, 0.5));
		pExpandableNode->addChild(pTitleLabel);


		sprintf(buff, "Label %d - 1", i);
		pExpandableNode->insertItemNodeAtLast(CLabel::create(buff, "", 30));
		sprintf(buff, "Label %d - 2", i);
		pExpandableNode->insertItemNodeAtLast(CLabel::create(buff, "", 30));
		sprintf(buff, "Label %d - 3", i);
		pExpandableNode->insertItemNodeAtLast(CLabel::create(buff, "", 30));
		
		CButton* pButton = CButton::createWith9Sprite(CCSize(150, 38), "sprite9_btn1.png", "sprite9_btn2.png");
		pButton->setOnClickListener(this, ccw_click_selector(CExpandableListViewBasicTest::onClick));
		pButton->initText("collapse", "", 28);
		pButton->setUserTag(i);
		pButton->setPosition(CCPoint(100, 40/2));
		CLayout* pBtnLayout = CLayout::create(CCSize(320, 40));
		pBtnLayout->addChild(pButton);
		pExpandableNode->insertItemNodeAtLast(pBtnLayout);
	}

	pListView->reloadData();
	

	return true;
}
开发者ID:cl0uddajka,项目名称:cocoswidget,代码行数:58,代码来源:ExpandableListViewTest.cpp

示例8: onTouchEnded

bool CLabelBasicTest::onTouchEnded(Ref* pSender, Touch* pTouch, float fDuration)
{
	CLabel* pText = (CLabel*) pSender;
	pText->stopActionByTag(1);
	ScaleTo* pScaleTo = ScaleTo::create(0.1f, 1.0f);
	pScaleTo->setTag(1);
	pText->runAction(pScaleTo);
	return true;
}
开发者ID:110440,项目名称:Tui-x,代码行数:9,代码来源:LabelTest.cpp

示例9: onTouchBegan

CWidgetTouchModel CLabelBasicTest::onTouchBegan(Ref* pSender, Touch* pTouch)
{
	CLabel* pText = (CLabel*) pSender;
	pText->stopActionByTag(1);
	ScaleTo* pScaleTo = ScaleTo::create(0.1f, 1.3f);
	pScaleTo->setTag(1);
	pText->runAction(pScaleTo);

	return eWidgetTouchTransient;
}
开发者ID:110440,项目名称:Tui-x,代码行数:10,代码来源:LabelTest.cpp

示例10: updateSelectServer

void LoginLayerUC::updateSelectServer()
{
	const Server& gameServer = m_serverInfo.server_list().Get(m_iSelectServerIndex);
	CLabel* pServerSelect = (CLabel*)m_pCurrentServerUI->findWidgetById("server_select");
	pServerSelect->setString(gameServer.server_name().c_str());
	CLabel* pServerSelectStatus = (CLabel*)m_pCurrentServerUI->findWidgetById("status_select");
	int iShowText[5] = {2002, 1184, 1185, 1186, 1187};
	pServerSelectStatus->setString(GETLANGSTR(iShowText[gameServer.server_status()]));

	UCSdk::s_serverid = 0;
	UCSdk::s_servername = gameServer.server_name();
}
开发者ID:54993306,项目名称:Classes,代码行数:12,代码来源:LoginLayerUC.cpp

示例11: CompleteInHandBook

void CHandBookHeroLayer::updateUI( )
{
	//图鉴收集比例
	int iCurrentN = CompleteInHandBook(&m_AtlasResponse);
	int iMax = m_AtlasResponse.atlas_list_size();
	CLabel *pText = (CLabel *)m_ui->findWidgetById("text");
	pText->setString(CCString::createWithFormat("%d/%d", iCurrentN, iMax)->getCString());


	m_pTableView->setCountOfCell(m_AtlasResponse.atlas_list_size());
	m_pTableView->reloadData();

}
开发者ID:54993306,项目名称:Classes,代码行数:13,代码来源:HandBookHero.cpp

示例12: CreateInterface

void CScreenSetupSound::CreateInterface()
{
    CWindow*        pw;
    CLabel*         pl;
    CSlider*        psl;
    CButton*        pb;
    Math::Point     pos, ddim;
    std::string     name;

    CScreenSetup::CreateInterface();
    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;

    pos.x = ox+sx*3;
    pos.y = 0.55f;
    ddim.x = dim.x*4.0f;
    ddim.y = 18.0f/480.0f;
    psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLSOUND);
    psl->SetState(STATE_SHADOW);
    psl->SetLimit(0.0f, MAXVOLUME);
    psl->SetArrowStep(1.0f);
    pos.y += ddim.y;
    GetResource(RES_EVENT, EVENT_INTERFACE_VOLSOUND, name);
    pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
    pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);

    pos.x = ox+sx*3;
    pos.y = 0.40f;
    ddim.x = dim.x*4.0f;
    ddim.y = 18.0f/480.0f;
    psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLMUSIC);
    psl->SetState(STATE_SHADOW);
    psl->SetLimit(0.0f, MAXVOLUME);
    psl->SetArrowStep(1.0f);
    pos.y += ddim.y;
    GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name);
    pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
    pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);

    ddim.x = dim.x*3;
    ddim.y = dim.y*1;
    pos.x = ox+sx*10;
    pos.y = oy+sy*2;
    pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SILENT);
    pb->SetState(STATE_SHADOW);
    pos.x += ddim.x;
    pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NOISY);
    pb->SetState(STATE_SHADOW);

    UpdateSetupButtons();
}
开发者ID:2asoft,项目名称:colobot,代码行数:51,代码来源:screen_setup_sound.cpp

示例13: PlayEffectSound

void CStrengthenItem::onTouchItem(CCObject* pSender)
{
	if(isVisible())
	{
		PlayEffectSound(SFX_Button);
	}

	CImageView * img = (CImageView*)pSender;
	m_item = (CItem*)img->getUserData();

	m_pItemTip->showItemProperty(m_item);

	CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr"));
	attribute->setVisible(true);

	m_selectCellImg->removeFromParent();
	img->addChild(m_selectCellImg);
	m_selectCellImg->setVisible(true);
	m_selectCellImg->setPosition(ccp(img->getContentSize().width/2,0/*img->getContentSize().height/2*/));

	CButton *select = (CButton*)(m_ui->findWidgetById("select")); //sel_font
	CLabel *selfont = (CLabel*)(m_ui->findWidgetById("sel_font"));
	if (m_toHero==m_item->armor.hero&&m_toHero>0)
	{
		select->setVisible(true);
		selfont->setVisible(false);
	}
	else if (m_toHero>0&&!m_item->canUse)
	{
		select->setVisible(false);
		selfont->setVisible(false);
	}
	else
	{
		select->setVisible(true);
		selfont->setVisible(true);
	}

	if (m_type==2)
	{
		if (m_toHero>0)
		{
			CImageView *uninstall = (CImageView*)(m_ui->findWidgetById("uninstall"));
			CImageView *change = (CImageView*)(m_ui->findWidgetById("change"));
			CImageView *selfont = (CImageView*)(m_ui->findWidgetById("sel_font"));
			uninstall->setVisible(m_toHero==m_item->armor.hero);
			change->setVisible(m_toHero!=m_item->armor.hero&&m_item->armor.hero>0&&m_item->canUse);
			selfont->setVisible(m_item->armor.hero==0&&m_item->canUse);
		}
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:51,代码来源:StrengthenItem.cpp

示例14: CBox

void CButtonBar::PushLabel(const std::string &n, const std::string &d)
{
    CBox *lbox = new CBox(HORIZONTAL, false);
    
    CLabel *label = new CLabel(n + ": ");
    label->SetDFColors(GetFColors());
    lbox->StartPack(label, false, false, 0, 0);
    
    label = new CLabel(d);
    label->SetDFColors(GetDFColors());
    lbox->StartPack(label, false, false, 0, 0);

    m_pCurBox->StartPack(lbox, true, false, 0, 0);
}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:14,代码来源:buttonbar.cpp

示例15: onCheck

void CToggleViewGroupTest::onCheck(Ref* pSender, bool bChecked)
{
	CToggleView* pToggle = (CToggleView*) pSender;
	CLabel* pText = (CLabel*) pToggle->getUserObject();

	if( bChecked )
	{
		pText->setString("checked");
	}
	else
	{
		pText->setString("unchecked");
	}
}
开发者ID:110440,项目名称:Tui-x,代码行数:14,代码来源:ToggleViewTest.cpp


注:本文中的CLabel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。