• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UILabel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addChild

bool UIImageViewTest_Scale9::init()
{
    if (UIScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        UILabel *alert = UILabel::create();
        alert->setText("ImageView scale9 render");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
//        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getRect().size.height * 1.75));
        m_pUiLayer->addWidget(alert);
        
        // Create the ui layer
        UILayer *ul = UILayer::create();
        ul->scheduleUpdate();
        addChild(ul);
        
        // Create the imageview
        UIImageView *imageView = UIImageView::create();
        imageView->setScale9Enabled(true);
        imageView->loadTexture("cocosgui/buttonHighlighted.png");
//        imageView->setScale9Size(CCSizeMake(200, 85));
//        imageView->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + imageView->getRect().size.height / 4.0f));
        ul->addWidget(imageView);
        
        return true;
    }
    return false;
}
开发者ID:nutty898,项目名称:Cocos2d-x-For-CocoStudio,代码行数:31,代码来源:UIImageViewTest.cpp


示例2: scheduleUpdate

bool UILoadingBarTest::init()
{
    if (UIScene::init())
    {
        scheduleUpdate();
        
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        // Add the alert
        UILabel *alert = UILabel::create();
        alert->setText("LoadingBar");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
//        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getRect().size.height * 1.75));
        m_pUiLayer->addWidget(alert);
        
        // Create the loading bar
        UILoadingBar* loadingBar = UILoadingBar::create();
        loadingBar->setName("LoadingBar");
        loadingBar->loadTexture("cocosgui/sliderProgress.png");
//        loadingBar->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + loadingBar->getRect().size.height / 4.0f));
        m_pUiLayer->addWidget(loadingBar);
        
        return true;
    }
    return false;
}
开发者ID:nutty898,项目名称:Cocos2d-x-For-CocoStudio,代码行数:28,代码来源:UILoadingBarTest.cpp


示例3: UIElement

PolycodeProjectBrowser::PolycodeProjectBrowser(PolycodeProject *project) : UIElement() {

    this->project = project;
    headerBg = new UIRect(10,10);
    addChild(headerBg);
    headerBg->setAnchorPoint(-1.0, -1.0, 0.0);
    headerBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));

    UILabel *label = new UILabel("PROJECT BROWSER", 18, "section", Label::ANTIALIAS_FULL);
    label->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderFontColor"));

    addChild(label);
    label->setPosition(10, 3);


    treeContainer = new UITreeContainer("boxIcon.png", project->getProjectName(), 200, 555);
    treeContainer->getRootNode()->toggleCollapsed();
    treeContainer->getRootNode()->addEventListener(this, UITreeEvent::SELECTED_EVENT);
    treeContainer->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
    treeContainer->setPosition(0, 30);

    BrowserUserData *data = new BrowserUserData();
    data->type = 0;
    data->parentProject = project;
    treeContainer->getRootNode()->setUserData((void*) data)	;

    addChild(treeContainer);
    selectedData = NULL;

    parseFolderIntoNode(treeContainer->getRootNode(), project->getRootFolder());
}
开发者ID:carlosmarti,项目名称:Polycode,代码行数:31,代码来源:PolycodeProjectBrowser.cpp


示例4: itemBtnCallBack

void Scene_GameItem::itemBtnCallBack(cocos2d::CCObject *object)
{
    UIButton* btn = (UIButton*)object;
    UIImageView* img;
    
    //通过游戏的道具信息获取道具价钱.
    sItemData* itemData = CGameInfoMan::sharedInstance().getItemDate(GameShare_Global::shareGlobal()->gameType, btn->getTag());

    UILabel* itemInfo = dynamic_cast<UILabel*>(ul->getWidgetByName("Label_591"));
    
    
    switch (btn->getTag()) {
        case Btn_1:
            img = dynamic_cast<UIImageView*>(ul->getWidgetByName("IsSelectImg_1"));
            break;
        case Btn_2:
            img = dynamic_cast<UIImageView*>(ul->getWidgetByName("IsSelectImg_2"));
            break;
        case Btn_3:
            img = dynamic_cast<UIImageView*>(ul->getWidgetByName("IsSelectImg_3"));
            break;
        case Btn_4:
            img = dynamic_cast<UIImageView*>(ul->getWidgetByName("IsSelectImg_4"));
            break;
        default:
            break;
    }
    
    if (img->isVisible()) {
        
        img->setVisible(false);

        if (itemData) {
            CCString infoStr;
            infoStr.initWithFormat("%s:%s",itemData->ItemName.c_str(),itemData->ItemDetail.c_str());
            itemInfo->setText(infoStr.getCString());
            needGold -= itemData->CurrencyValue;
        }
    }else{
        img->setVisible(true);
        if (itemData) {
            CCString infoStr;
            infoStr.initWithFormat("%s:%s",itemData->ItemName.c_str(),itemData->ItemDetail.c_str());
            itemInfo->setText(infoStr.getCString());
            needGold += itemData->CurrencyValue;
            if (CPlayerInfoMan::sharedInstance().getPlayerInfo().nMoney < needGold) {
                GameLayer_Alert *alertUl = GameLayer_Alert::creatWithOnlySure(Type_OnlySure);
                needGold -= itemData->CurrencyValue;
                alertUl->setText(GET_STRING_CSV(1010000021));
                this->addChild(alertUl,1);
                img->setVisible(false);
            }
        }
        
    }
    this->setItemByTag(btn->getTag());
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:57,代码来源:Scene_GameItem.cpp


示例5: UILabel

UILabel* UI::addLabel(int id, int x, int y, int width, int height, const char* text)
{
    UILabel* label = new UILabel(mRootNode);
    label->nodeID = id;
    label->setPos(x, y);
    label->setText(text);
    label->setSize(width, height);
    nodeList.push_back(label);
    return label;
}
开发者ID:cdaniel8937,项目名称:cashew,代码行数:10,代码来源:UI.cpp


示例6: UILabel

UILabel* UILabel::create()
{
    UILabel* widget = new UILabel();
    if (widget && widget->init())
    {
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return NULL;
}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:10,代码来源:UILabel.cpp


示例7: init

bool UILabelTest::init()
{
    if (UIScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        UILabel *alert = UILabel::create();
        alert->setText("Label");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
//        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getRect().size.height * 1.75));
        m_pUiLayer->addWidget(alert);
        
        // Create the label
        UILabel* label = UILabel::create();
        label->setText("Label");
        label->setFontName("AmericanTypewriter");
        label->setFontSize(30);
//        label->setPosition(ccp(screenSize.width / 2, screenSize.height / 2 + label->getRect().size.height / 4));
        m_pUiLayer->addWidget(label);
        
        return true;
    }
    return false;
}
开发者ID:nutty898,项目名称:Cocos2d-x-For-CocoStudio,代码行数:26,代码来源:UILabelTest.cpp


示例8: showSecondNextLevelAttributionLabel

void EquipmentUpgradeUILayer::showSecondNextLevelAttributionLabel(const char* text)
{
	if(m_equipmentLayout)
	{
		UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddNextLevel2");
		if(label)
		{
			label->setString(text);
		}
	}
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:11,代码来源:EquipmentUpgradeUILayer.cpp


示例9: showCurrentAttributeLabel

void EquipmentUpgradeUILayer::showCurrentAttributeLabel(const char* text)
{
	if(m_equipmentLayout)
	{
		UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddSkill");
		if(label)
		{
			label->setString(text);
		}
	}
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:11,代码来源:EquipmentUpgradeUILayer.cpp


示例10: UILabel

UILabel* UILabel::create()
{
	UILabel *node = new UILabel();
	if (node)
	{
		node->autorelease();
		return node;
	}
	CC_SAFE_DELETE(node);
	return NULL;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:11,代码来源:UILabel.cpp


示例11: copySpecialProperties

void UILabel::copySpecialProperties(UIWidget *widget)
{
    UILabel* label = dynamic_cast<UILabel*>(widget);
    if (label)
    {
        setFontName(label->_fontName.c_str());
        setFontSize(label->_labelRenderer->getFontSize());
        setText(label->getStringValue());
        setTouchScaleChangeEnabled(label->_touchScaleChangeEnabled);
    }
}
开发者ID:CryQ,项目名称:coclua,代码行数:11,代码来源:UILabel.cpp


示例12: UILabel

UILabel* UILabel::create()
{
    UILabel* widget = new UILabel();
    if (widget && widget->init())
    {
        widget->autorelease();
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return nullptr;
}
开发者ID:CryQ,项目名称:coclua,代码行数:11,代码来源:UILabel.cpp


示例13: showCurrentName

void EquipmentUpgradeUILayer::showCurrentName(const char* name,const ccColor3B& color)
{
	if(m_equipmentLayout)
	{
		UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedName");
		if(label)
		{
			label->setString(name);
			label->setColor(color);
		}
	}
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:12,代码来源:EquipmentUpgradeUILayer.cpp


示例14: setInfoNum

void GameLayer_Menu::setInfoNum()
{
    UIImageView* img = dynamic_cast<UIImageView*>(gameMenu->getWidgetByName("Email_RemindImg"));
    if (CPlayerInfoMan::sharedInstance().getPlayerInfo().sysInfoNum <= 0) {
        img->setVisible(false);
    }else{
        img->setVisible(true);
        UILabel* label = dynamic_cast<UILabel*>(gameMenu->getWidgetByName("InfoLabel"));
        CCString str;
        str.initWithFormat("%d",CPlayerInfoMan::sharedInstance().getPlayerInfo().sysInfoNum);
        label->setText(str.getCString());
    }
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:13,代码来源:GameLayer_Menu.cpp


示例15: Widget

void UICanvas::showMessageBox(const String& message)
{
	Widget* modalBackground = new Widget();
	
	UIWindow* surface = addSurface("modal");
	surface->attach(modalBackground);
	modalBackground->setRect(surface->getRect());

	UILabel* label = new UILabel(message);
	label->setSize(700,50);
	//label->setCenter(modalBackground->getMiddlePosition());
	modalBackground->attach(label);
};
开发者ID:GrimshawA,项目名称:Nephilim,代码行数:13,代码来源:UICanvas.cpp


示例16: atoi

void ShopLayer::updateBuyLayout(CCObject* pSender,bool isVis)
{
	UIButton* btn = dynamic_cast<UIButton*>(pSender);
	UILabel* nameLab = dynamic_cast<UILabel*>(m_buyLayout->getChildByName("propNameLabel"));
	nameLab->setText(dynamic_cast<UILabel*>(btn->getChildByName("nameLabel"))->getStringValue());

	UIImageView* discountImg = dynamic_cast<UIImageView*>(m_buyLayout->getChildByName("discountImg"));
	discountImg->setVisible(isVis);
	m_onePri = atoi(dynamic_cast<UILabel*>(btn->getChildByName("priLabel"))->getStringValue());
	m_onePriLabel->setText(CCString::createWithFormat("%d",m_onePri)->getCString());
	m_buyNum = 1;
	m_totalPriLabel->setText(CCString::createWithFormat("%d",m_onePri*m_buyNum)->getCString());
}
开发者ID:Dream-Hat,项目名称:mdsj,代码行数:13,代码来源:ShopMediator.cpp


示例17: UIWindow

EditorGridSettingsWindow::EditorGridSettingsWindow(EditorGrid *grid) : UIWindow("Grid Settings", 100, 190) {
    
    visible = false;
    enabled = false;
    
    this->grid = grid;
    
    visibleCheck = new UICheckBox("Enabled", grid->visible);
    addChild(visibleCheck);
    visibleCheck->setPosition(10, 40);
    visibleCheck->addEventListener(this, UIEvent::CHANGE_EVENT);
    
    UILabel *label = new UILabel("Size:", 12);
    label->setColor(1.0, 1.0 ,1.0, 1.0);
    addChild(label);
    label->setPosition(10, 70);
    
    sizeInput = new UITextInput(false, 50, 10);
    addChild(sizeInput);
    sizeInput->setPosition(60, 68);
    sizeInput->setNumberOnly(true);
    sizeInput->setText(String::NumberToString(grid->getGridSize()));
    sizeInput->addEventListener(this, UIEvent::CHANGE_EVENT);
    
    label = new UILabel("Count:", 12);
    label->setColor(1.0, 1.0 ,1.0, 1.0);
    addChild(label);
    label->setPosition(10, 100);

    countInput = new UITextInput(false, 50, 10);
    addChild(countInput);
    countInput->setPosition(60, 98);
    countInput->setNumberOnly(true);
    countInput->setText(String::IntToString(grid->getGridLen()));
    countInput->addEventListener(this, UIEvent::CHANGE_EVENT);
    
    xAxisBox = new UICheckBox("X Axis", grid->isXAxisEnabled());
    addChild(xAxisBox);
    xAxisBox->setPosition(10, 130);
    xAxisBox->addEventListener(this, UIEvent::CHANGE_EVENT);
    
    yAxisBox = new UICheckBox("Y Axis", grid->isYAxisEnabled());
    addChild(yAxisBox);
    yAxisBox->setPosition(10, 155);
    yAxisBox->addEventListener(this, UIEvent::CHANGE_EVENT);
    
    zAxisBox = new UICheckBox("Z Axis", grid->isZAxisEnabled());
    addChild(zAxisBox);
    zAxisBox->setPosition(10, 180);
    zAxisBox->addEventListener(this, UIEvent::CHANGE_EVENT);
}
开发者ID:Anwesh43,项目名称:Polycode,代码行数:51,代码来源:EditorGrid.cpp


示例18: init

bool QiangHuaLayer::init(HeroType hero)
{
    if(!CCLayer::init())
    {
        return false;
    }
    m_hero=hero;
    bUpgrade=false;
    m_pUiLayer=UILayer::create();

    this->addChild(m_pUiLayer);
    CCSize winSize =CCDirector::sharedDirector()->getWinSize();
    UIImageView* imageView = UIImageView::create();
    imageView->setTexture("herolistbg.png");
    imageView->setPosition(ccp(winSize.width/2,winSize.height/2));
    m_pUiLayer->addWidget(imageView);
    
    UIImageView* heroImage = UIImageView::create();
    heroImage->setTexture(hero.textureName.c_str());
    heroImage->setPosition(ccp(winSize.width/2,winSize.height/2));
    m_pUiLayer->addWidget(heroImage);
    
    UIImageView* coinImage = UIImageView::create();
    coinImage->setTexture("coins.png");
    coinImage->setPosition(ccp(coinImage->getContentSize().width/2+30,winSize.height/2));
    coinImage->setTag(111);
    m_pUiLayer->addWidget(coinImage);
    
    
    UILabel *label = UILabel::create();
    char str[32];
    sprintf(str,"%d",hero.level);
    label->setText(str);
    m_pUiLayer->addWidget(label);
    
    UIButton *btn=UIButton::create();
    btn->setTouchEnabled(true);
    btn->setTextures("qianghua1.png","qianghua2.png","");
    btn->setPosition(ccp(winSize.width/2,winSize.height/2-250));
    btn->addReleaseEvent(this, coco_releaseselector(QiangHuaLayer::qianghua));
    m_pUiLayer->addWidget(btn);
    
    UIButton *btnclose=UIButton::create();
    btnclose->setTouchEnabled(true);
    btnclose->setTextures("close1.png","close2.png","close2.png");
    btnclose->setPosition(ccp(winSize.width-60, winSize.height/2+300));
    btnclose->addReleaseEvent(this, coco_releaseselector(QiangHuaLayer::close));
    m_pUiLayer->addWidget(btnclose);
    getHeros();
    return true;
}
开发者ID:EvilStart,项目名称:shuihucard,代码行数:51,代码来源:QiangHuaLayer.cpp


示例19: sprintf

void EquipmentUpgradeUILayer::showEquipName(unsigned int index,const char* name,const ccColor3B& color)
{
	if(m_equipmentLayout)
	{
		char lableName[30];
		sprintf(lableName,"equipUpgradeLabel%d",index);
		UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>(lableName);
		if(label)
		{
			label->setString(name);
			label->setColor(color);
		}
	}
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:14,代码来源:EquipmentUpgradeUILayer.cpp


示例20: UILabel

void UIMenu::addMenuBreak() {
	UILabel* label = new UILabel(gfx);
	label->setColor(MENU_TEXT_COLOR);
	label->setText("...", 0, text_size);
	label->setPosition(vector2());
	label->setActive(false);
//	label->fadeIn();
	
	//size[0] = 18;
	size[1] = (labels_n+1)*text_size;
	
	gfx->addSceneNode(label, this);
	labels.push_back(label);
	labels_n++;	
}
开发者ID:albertz,项目名称:SaveTheRock,代码行数:15,代码来源:ui.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UILayer类代码示例发布时间:2022-05-31
下一篇:
C++ UIForegroundRefPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap