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


C++ ImageView::loadTexture方法代码示例

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


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

示例1: PageInit

void CocosGUIExamplesPageScene::PageInit()
{
    // page root from json
    Layout* page_root = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile("cocosgui/gui_examples/page_1/page_1.json"));
    m_pUILayer->addWidget(page_root);
    
    // page layout
    Layout* page_layout = dynamic_cast<Layout*>(page_root->getChildByName("page_panel"));
    
    // page view add to page layout
    PageView* pageView = PageView::create();
    pageView->setTouchEnabled(true);
    pageView->setSize(page_layout->getSize());
    
    // layout add to page view
    for (int i = 0; i < 4; ++i)
    {
        Layout* layout = Layout::create();
        layout->setSize(pageView->getSize());
        
        ImageView* imageView = ImageView::create();
        imageView->setTouchEnabled(true);
        imageView->loadTexture(page_image_textures[i]);
        imageView->setPosition(ccp(layout->getSize().width / 2, layout->getSize().height / 2));
        layout->addChild(imageView);                
        
        pageView->addPage(layout);
    }
    pageView->addEventListenerPageView(this, pagevieweventselector(CocosGUIExamplesPageScene::pageViewEvent));
    page_layout->addChild(pageView);
}
开发者ID:MKSoft,项目名称:CocoStudioSamples,代码行数:31,代码来源:CocosGUIExamplesPageScene.cpp

示例2:

bool UIImageViewTest_Scale9::init()
{
    if (UIScene::init())
    {
        Size widgetSize = _widget->getSize();
        
        Text* alert = Text::create();
        alert->setText("ImageView scale9 render");
        alert->setFontName("Marker Felt");
        alert->setFontSize(26);
        alert->setColor(Color3B(159, 168, 176));
        alert->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 2.125f));
        _uiLayer->addChild(alert);        
        
        // Create the imageview
        ImageView* imageView = ImageView::create();
        imageView->setScale9Enabled(true);
        imageView->loadTexture("cocosgui/buttonHighlighted.png");
        imageView->setSize(Size(200, 85));
        imageView->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f + imageView->getSize().height / 4.0f));
        _uiLayer->addChild(imageView);                
        
        return true;
    }
    return false;
}
开发者ID:6520874,项目名称:CocoStudioSamplesBasedOnCocos2d-x3.0,代码行数:26,代码来源:UIImageViewTest.cpp

示例3: setPropsWithFlatBuffers

 void ImageViewReader::setPropsWithFlatBuffers(cocos2d::Node *node, const flatbuffers::Table *imageViewOptions)
 {
     ImageView* imageView = static_cast<ImageView*>(node);
     auto options = (ImageViewOptions*)imageViewOptions;
     
     
     auto imageFileNameDic = options->fileNameData();
     int imageFileNameType = imageFileNameDic->resourceType();
     std::string imageFileName = imageFileNameDic->path()->c_str();
     imageView->loadTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
     
     bool scale9Enabled = options->scale9Enabled();
     imageView->setScale9Enabled(scale9Enabled);
     
     auto widgetReader = WidgetReader::getInstance();
     widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
     
     if (scale9Enabled)
     {
         imageView->setUnifySizeEnabled(false);
         imageView->ignoreContentAdaptWithSize(false);
         
         auto f_scale9Size = options->scale9Size();
         Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
         imageView->setContentSize(scale9Size);
         
         
         auto f_capInset = options->capInsets();
         Rect capInsets(f_capInset->x(), f_capInset->y(), f_capInset->width(), f_capInset->height());
         imageView->setCapInsets(capInsets);
     }
     
 }
开发者ID:1097195326,项目名称:GameAreas,代码行数:33,代码来源:ImageViewReader.cpp

示例4: setHeros

void SelectHeroLayer::setHeros( Vector<HeroModel*> heros)
{
	lstHero->removeAllItems();

	Node* rootNode = CSLoader::createNode("SelectHeroItem.csb");
	Layout* itemRoot = static_cast<Layout*> (rootNode->getChildByName("root"));

	itemRoot->setTouchEnabled(true);
	itemRoot->addTouchEventListener(CC_CALLBACK_2(SelectHeroLayer::selectTouchEvent, this));

	for(HeroModel* hero:heros)
	{
		Layout* item = (static_cast<Layout*>(itemRoot->clone()));
		lstHero->pushBackCustomItem(item);

		item->setUserObject(hero);
		Text* txtServerName = static_cast<Text*>(Helper::seekWidgetByName(item, "txtHeroName"));
		txtServerName->setString(hero->m_heroName);

		ImageView* imgState = static_cast<ImageView*>(Helper::seekWidgetByName(item, "imgHero"));
		imgState->loadTexture(hero->getHeroImage());


	}
}
开发者ID:baidang201,项目名称:MaiziGame,代码行数:25,代码来源:SelectHeroLayer.cpp

示例5: touchEvent

void UIButtonTest::touchEvent(Ref *pSender, Widget::TouchEventType type)
{
    switch (type)
    {
        case Widget::TouchEventType::BEGAN:
            _displayValueLabel->setString(String::createWithFormat("Touch Down")->getCString());
            break;
            
        case Widget::TouchEventType::MOVED:
            _displayValueLabel->setString(String::createWithFormat("Touch Move")->getCString());
            break;
            
        case Widget::TouchEventType::ENDED:
        {
            _displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString());
            ImageView* imageView = (ImageView*)_uiLayer->getChildByTag(12);
            imageView->setVisible(false);
            imageView->loadTexture("cocosui/ccicon.png");
            imageView->setOpacity(0);
            imageView->setVisible(true);
            imageView->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), nullptr));
            Button *btn = (Button*)pSender;
            btn->loadTextureNormal("cocosui/animationbuttonnormal.png");
        }
            break;
            
        case Widget::TouchEventType::CANCELED:
            _displayValueLabel->setString(String::createWithFormat("Touch Cancelled")->getCString());
            break;
            
        default:
            break;
    }
}
开发者ID:jafffy,项目名称:cocos2d-x,代码行数:34,代码来源:UIButtonTest.cpp

示例6: init

bool Inventory::init()
{
    if (!Node::init())
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    
    relativeLayout = Layout::create();
    relativeLayout->setSize(visibleSize);
    relativeLayout->setClippingEnabled(true);
    relativeLayout->setLayoutType(LAYOUT_RELATIVE);
    this->addChild(relativeLayout);
   
    simpleLayout = Layout::create();
    simpleLayout->setSize(visibleSize);
    simpleLayout->setClippingEnabled(true);
    this->addChild(simpleLayout);
    
    ImageView *imageViewInList = ImageView::create();
    imageViewInList->loadTexture("tool.png");
    
    listView = ListView::create();
    listView->setBackGroundColorType(LAYOUT_COLOR_SOLID);
    listView->setBackGroundColor(Color3B::MAGENTA);
    listView->setPosition(Point(100, 100));
    listView->setSize(Size(500, 80));
    listView->setDirection(SCROLLVIEW_DIR_HORIZONTAL);
    relativeLayout->addChild(listView);
    
    RelativeLayoutParameter *rpListView = RelativeLayoutParameter::create();
    rpListView->setAlign(RELATIVE_ALIGN_PARENT_TOP_CENTER_HORIZONTAL);
    rpListView->setMargin(Margin(0, 20, 0, 0));
    listView->setLayoutParameter(rpListView);
    
    ImageView *imageView = ImageView::create();
    imageView->loadTexture("tool.png");
    imageView->setVisible(false);
    relativeLayout->addChild(imageView);

    //DataManager::getInstance()->decCraftCount(0);
    //DataManager::getInstance()->save();
    
    return true;
}
开发者ID:kovalgek,项目名称:quest2,代码行数:46,代码来源:Inventory.cpp

示例7: setPropsFromBinary

    void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
    {
        WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
        
        ImageView* imageView = static_cast<ImageView*>(widget);
        this->beginSetBasicProperties(widget);
        float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
        
        stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);

        for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
            std::string key = stChildArray[i].GetName(cocoLoader);
            std::string value = stChildArray[i].GetValue(cocoLoader);

            //read all basic properties of widget
            CC_BASIC_PROPERTY_BINARY_READER
            //read all color related properties of widget
            CC_COLOR_PROPERTY_BINARY_READER
            
            else if (key == P_Scale9Enable) {
                imageView->setScale9Enabled(valueToBool(value));
            }
            else if (key == P_FileNameData){
                stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
                std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
                
                Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
                
                std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);

                imageView->loadTexture(backgroundValue, imageFileNameType);
                
            }
            else if(key == P_Scale9Width){
                imageView->setContentSize(Size(valueToFloat(value), imageView->getContentSize().height));
            }else if(key == P_Scale9Height){
                imageView->setContentSize(Size(imageView->getContentSize().width, valueToFloat(value)));
            }
            else if(key == P_CapInsetsX){
                capsx = valueToFloat(value);
            }else if(key == P_CapInsetsY){
                capsy = valueToFloat(value);
            }else if(key == P_CapInsetsWidth){
                capsWidth = valueToFloat(value);
            }else if(key == P_CapInsetsHeight){
                capsHeight = valueToFloat(value);
            }
            
        } //end of for loop
        
        if (imageView->isScale9Enabled()) {
            imageView->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
        }
        
        this->endSetBasicProperties(widget);

    }
开发者ID:DominicD,项目名称:Hyperdrive,代码行数:57,代码来源:ImageViewReader.cpp

示例8: init

bool UIImageViewTest::init()
{
    if (UIScene::init())
    {
        Size widgetSize = _widget->getSize();
        
        Text* alert = Text::create();
        alert->setText("ImageView");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(Color3B(159, 168, 176));
        alert->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 1.75f));
        _uiLayer->addChild(alert);        
        
        // Create the imageview
        ImageView* imageView = ImageView::create();
        imageView->loadTexture("cocosgui/ccicon.png");
        imageView->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f + imageView->getSize().height / 4.0f));
        
//        imageView->setOpacity(64);
        _uiLayer->addChild(imageView);
        
        /*
        NodeRGBA* root = NodeRGBA::create();
        root->setCascadeOpacityEnabled(true);
        NodeRGBA* render = Sprite::create();
        static_cast<Sprite*>(render)->setTexture("cocosgui/ccicon.png");
        root->addChild(render);
//        root->setOpacity(64);
        root->setPosition(Point(200, 180));
        _uiLayer->addChild(root);
         */
        
        /*
        NodeRGBA* nodergba = NodeRGBA::create();
        Sprite* child = Sprite::create();
        child->setTexture("cocosgui/ccicon.png");
        nodergba->addChild(child);
        nodergba->setPosition(Point(120, 80));
        nodergba->setOpacity(64);
        _uiLayer->addChild(nodergba);
         */
        
        /*
        Sprite* sprite = Sprite::create();
        sprite->setTexture("cocosgui/ccicon.png");
        sprite->setPosition(Point(200, 180));
//        sprite->setOpacity(64);
        _uiLayer->addChild(sprite);
         */
        
//        imageView->setLocalZOrder(20);
        
        return true;
    }
    return false;
}
开发者ID:6520874,项目名称:CocoStudioSamplesBasedOnCocos2d-x3.0,代码行数:57,代码来源:UIImageViewTest.cpp

示例9: setItemData

//设置单个模版的数据显示
void Gate::setItemData(Widget*item,PGateItem gateItem)
{
    Text*desTxt=static_cast<Text*>(item->getChildByName("desTxt"));
    Label* desLabel = static_cast<Label*>(desTxt->getVirtualRenderer());
    desLabel->enableOutline(Color4B::BLACK,1);
    //此处需要判断是否有倒计时,没有倒计时就隐藏此文本,否则具体显示倒计时(策划说以后会有个事件表,从里面读取时间)
    
    ImageView* items = static_cast<ImageView*>(item);
    items->loadTexture("Level Select_Book_A"+Value(this->currentType).asString()+".png");
}
开发者ID:robert1111,项目名称:fancyHeart,代码行数:11,代码来源:Gate.cpp

示例10: initRoomItemCallback

void GameHallLayer::initRoomItemCallback(Widget* widget, MyRoomList room)
{
    ImageView* img = static_cast<ImageView*>(UIHelper::seekWidgetByName(widget, "Image_back"));
    ImageView* enter = static_cast<ImageView*>(img->getChildByName("Image_enter"));
    Label*  lblWord = static_cast<Label*>(enter->getChildByName("Label_word"));
    Widget* panelFree = UIHelper::seekWidgetByName(widget, "Image_free_back");
    
    string room_back;
    string word;
    int level = DataManager::sharedDataManager()->currLevel;
    unsigned long long gold = DataManager::sharedDataManager()->currGold;
    
    if (level >= room.roomLevelLimt && gold >= room.roomGoldLimt)
    {
        word = "进入";
        room_back = CCString::createWithFormat("room%d.png",room.roomid)->getCString();
        
        //显示免费转动次数
        if (1 == room.roomid && DataManager::sharedDataManager()->currFreeNum > 0)
        {
            ImageView* freeIcon = static_cast<ImageView*>(UIHelper::seekWidgetByName(panelFree, "Image_free"));
            Label* freeNum = static_cast<Label*>(UIHelper::seekWidgetByName(panelFree, "Label_freeNum"));
            
            panelFree->setVisible(true);
            freeIcon->loadTexture(CCString::createWithFormat("free%d.png",room.roomid)->getCString(),UI_TEX_TYPE_PLIST);
            freeNum->setText(CCString::createWithFormat("x%d",DataManager::sharedDataManager()->currFreeNum)->getCString());
        }
    }
    else
    {
        if (level < room.roomLevelLimt)
            word = CCString::createWithFormat("%d级" , room.roomLevelLimt)->getCString();
        else
            word = CCString::createWithFormat("%lld万", room.roomGoldLimt / 10000)->getCString();
        
        room_back = CCString::createWithFormat("room%d_grey.png",room.roomid)->getCString();
    }
    
    string room_btn = CCString::createWithFormat("button_room%d.png",room.roomid)->getCString();
    enter->loadTexture(room_btn.c_str(),UI_TEX_TYPE_PLIST);
    img->loadTexture(room_back.c_str(),UI_TEX_TYPE_PLIST);
    lblWord->setText(word);
}
开发者ID:mrktj,项目名称:SlotGame,代码行数:43,代码来源:GameHallLayer.cpp

示例11: init

bool BackgroundInGame::init() {
    if (!UILayer::init()) return false;
    
    this->setAnchorPoint(ccp(0, 0));
    
    ImageView *bg = ImageView::create();
    bg->loadTexture("table.png");
    
    bg->setAnchorPoint(ccp(0, 0));
    
    this->addWidget(bg);
    
    return true;
}
开发者ID:mrktj,项目名称:iCasino_v2,代码行数:14,代码来源:_Background_inGame_.cpp

示例12: SetSingleCellInfo

bool UI_Bag_Gem_Layer::SetSingleCellInfo(const int nTagID, Game_Data::Item_Container * pInfo)
{
	/************************************************************************/
	// 设置单个Cell的信息
	// 1. 判断索引ID是否异常
	if (nTagID >= MAX_TAG_COUNT)
		return false;

	// 2. 获取该物品的Config
	Game_Data::Item_Config * pItemConfig = ITEM_CONFIG_MGR::instance()->get_item_config(pInfo->item_id);
	if (pItemConfig == NULL)
		return false;

	// 3. 读取Json文件获取包裹每一个单元格
	Widget *pLayer = dynamic_cast<Widget*>(m_pBagGemScrollView->getChildByTag(nTagID));
	if (pLayer == NULL)
		return false;

	/************************************************************************/
	// 条件满足设置物品信息
	int nTemp = 0;
	const char * szTemp;
	// 1. 设置Icon
	ImageView * pMaterialImage = dynamic_cast<ui::ImageView*>(Helper::seekWidgetByName(pLayer, "Icon_ImagerView"));
	if (pMaterialImage == NULL)
		return false;

	szTemp	= ITEM_CONFIG_MGR::instance()->get_icon_path(pItemConfig->icon);
    std::string p("icon/");
    p+=szTemp;
	nTemp	= strcmp(p.c_str(), "");
	if (nTemp <= 0)
		return false;

	pMaterialImage->loadTexture(p.c_str());
	pMaterialImage->setVisible(true);
	
	// 2. 设置物品的个数
	TextAtlas * pMateriCount = dynamic_cast<ui::TextAtlas*>(Helper::seekWidgetByName(pLayer, "Count_Text"));
	if (pMaterialImage == NULL)
		return false;

	pMateriCount->setString(CCString::createWithFormat("%d", pInfo->item_count)->getCString());
	pMateriCount->setVisible(true);

	// 3. 为每件物品注册点击事件
	pMaterialImage->setTag(nTagID);
	pMaterialImage->addTouchEventListener(CC_CALLBACK_2(UI_Bag_Gem_Layer::OnBtnClickMaterialCallBack, this));
	return true;
}
开发者ID:ff78,项目名称:son,代码行数:50,代码来源:UI_Bag_Gem_Layer.cpp

示例13: setPropsFromJsonDictionary

    void ImageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
    {
        WidgetReader::setPropsFromJsonDictionary(widget, options);
        
        
        
        ImageView* imageView = static_cast<ImageView*>(widget);
        
        const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, P_FileNameData);
        int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, P_ResourceType);
        const std::string& imageFilePath = DICTOOL->getStringValue_json(imageFileNameDic, P_Path);

        if (!imageFilePath.empty()) {
        	std::string imageFileName = this->getResourcePath(imageFileNameDic, P_Path, (Widget::TextureResType)imageFileNameType);
        	imageView->loadTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
        }
                
        
        bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, P_Scale9Enable);
        bool scale9Enable = false;
        if (scale9EnableExist)
        {
            scale9Enable = DICTOOL->getBooleanValue_json(options, P_Scale9Enable);
        }
        imageView->setScale9Enabled(scale9Enable);
        
        
        if (scale9Enable)
        {
          
            float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width,80.0f);
            float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height,80.0f);
            imageView->setContentSize(Size(swf, shf));
            
            
            float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX);
            float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY);
            float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth,1.0f);
            float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight,1.0f);
            
            imageView->setCapInsets(Rect(cx, cy, cw, ch));
            
        }
        
        
        WidgetReader::setColorPropsFromJsonDictionary(widget, options);
    }        
开发者ID:DominicD,项目名称:Hyperdrive,代码行数:47,代码来源:ImageViewReader.cpp

示例14: setPropsFromProtocolBuffers

    void ImageViewReader::setPropsFromProtocolBuffers(ui::Widget *widget, const protocolbuffers::NodeTree &nodeTree)
    {
        WidgetReader::setPropsFromProtocolBuffers(widget, nodeTree);
        
        const protocolbuffers::ImageViewOptions& options = nodeTree.imageviewoptions();        
        ImageView* imageView = static_cast<ImageView*>(widget);

		std::string protocolBuffersPath = GUIReader::getInstance()->getFilePath();
        
        const protocolbuffers::ResourceData& imageFileNameDic = options.filenamedata();
        int imageFileNameType = imageFileNameDic.resourcetype();
        std::string imageFileName = this->getResourcePath(imageFileNameDic.path(), (Widget::TextureResType)imageFileNameType);
        imageView->loadTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
        
        
        bool scale9EnableExist = options.has_scale9enable();
        bool scale9Enable = false;
        if (scale9EnableExist)
        {
            scale9Enable = options.scale9enable();
        }
        imageView->setScale9Enabled(scale9Enable);
        
        
        if (scale9Enable)
        {
            imageView->setUnifySizeEnabled(false);
            imageView->ignoreContentAdaptWithSize(false);
            
            float swf = options.has_scale9width() ? options.scale9width() : 80.0f;
            float shf = options.has_scale9height() ? options.scale9height() : 80.0f;
            imageView->setContentSize(Size(swf, shf));
            
            
            float cx = options.capinsetsx();
            float cy = options.capinsetsy();
            float cw = options.has_capinsetswidth() ? options.capinsetswidth() : 1.0;
            float ch = options.has_capinsetsheight() ? options.capinsetsheight() : 1.0;
            
            imageView->setCapInsets(Rect(cx, cy, cw, ch));
            
        }
        
        // other commonly protperties
        WidgetReader::setColorPropsFromProtocolBuffers(widget, nodeTree);
    }
开发者ID:SunLightJuly,项目名称:Quick-PrebuiltRuntimeLua,代码行数:46,代码来源:ImageViewReader.cpp

示例15: setFriendsList

void UI_Friend::setFriendsList()
{
    Text* t;
    
    t = (Text*)rootNode->getChildByTag(T_FRIENDS_TOTALGOLDS);
    t->setString(StringUtils::format("%d", _player->friendsTotalGolds));
    GAMELOG("friendsTotalGolds = %d", _player->friendsTotalGolds);
    t = (Text*)rootNode->getChildByTag(T_FRIENDS_TOTALPOINTS);
    t->setString(StringUtils::format("%d", _player->friendsTotalPoints));
    GAMELOG("friendsTotalPoints = %d", _player->friendsTotalPoints);
    IPlayerData *ipayerData = M_GET_PLAYER;
//    ipayerData->golds+=_player->friendsTotalGolds;
//    ipayerData->totalpoints+=_player->friendsTotalPoints;
    t = (Text*)rootNode->getChildByTag(T_TOTALGOLDS);
    t->setString(StringUtils::format("%d",_player->friendsgolds));// _player->friendsTotalGolds));
    
    t = (Text*)rootNode->getChildByTag(T_TOTALPOINTS);
    t->setString(StringUtils::format("%d", _player->friendspoints));//_player->friendsTotalPoints));
    
    l_friends->removeAllItems();
    
    for(uint i = 0; i < _player->v_friends.size(); i ++)
    {
        Text* t;
        l_friends->pushBackDefaultItem();
        Widget* cell = l_friends->getItem(i);
        ImageView* head = (ImageView*)cell->getChildByTag(41);//头像
        head->loadTexture(StringUtils::format("CSres/Setup/Head/%s", _player->v_friends[i].uHeadIndex.c_str()));
        t = (Text*)cell->getChildByTag(42);//昵称
        t->setString(_player->v_friends[i].nickname);
        t = (Text*)cell->getChildByTag(43);//被邀请人等级
        t->setString(_player->v_friends[i].rankname);
//        t = (Text*)cell->getChildByTag(45);//等级记录
//        t->setString(_player->v_friends[i].recordgrade);
        t = (Text*)cell->getChildByTag(47);//总金币
        t->setString(StringUtils::format("%d", _player->v_friends[i].totalgolds));
        t = (Text*)cell->getChildByTag(49);//今日贡献金币
        t->setString(StringUtils::format("%d", _player->v_friends[i].todaygolds));
    }
    l_friends->jumpToPercentVertical(0);
}
开发者ID:PinLe2016,项目名称:pinlegame2.2.1,代码行数:41,代码来源:UI_Friend.cpp


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