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


C++ ListView::setBackGroundColorOpacity方法代码示例

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


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

示例1: setPropsWithFlatBuffers

 void ListViewReader::setPropsWithFlatBuffers(cocos2d::Node *node, const flatbuffers::Table *listViewOptions)
 {
     ListView* listView = static_cast<ListView*>(node);
     auto options = (ListViewOptions*)listViewOptions;
     
     bool clipEnabled = options->clipEnabled();
     listView->setClippingEnabled(clipEnabled);
     
     bool backGroundScale9Enabled = options->backGroundScale9Enabled();
     listView->setBackGroundImageScale9Enabled(backGroundScale9Enabled);
     
     
     auto f_bgColor = options->bgColor();
     Color3B bgColor(f_bgColor->r(), f_bgColor->g(), f_bgColor->b());
     auto f_bgStartColor = options->bgStartColor();
     Color3B bgStartColor(f_bgStartColor->r(), f_bgStartColor->g(), f_bgStartColor->b());
     auto f_bgEndColor = options->bgEndColor();
     Color3B bgEndColor(f_bgEndColor->r(), f_bgEndColor->g(), f_bgEndColor->b());
     
     auto f_colorVecor = options->colorVector();
     Vec2 colorVector(f_colorVecor->vectorX(), f_colorVecor->vectorY());
     listView->setBackGroundColorVector(colorVector);
     
     int bgColorOpacity = options->bgColorOpacity();
     
     int colorType = options->colorType();
     listView->setBackGroundColorType(Layout::BackGroundColorType(colorType));
     
     listView->setBackGroundColor(bgStartColor, bgEndColor);
     listView->setBackGroundColor(bgColor);
     listView->setBackGroundColorOpacity(bgColorOpacity);
     
     
     auto imageFileNameDic = options->backGroundImageData();
     int imageFileNameType = imageFileNameDic->resourceType();
     std::string imageFileName = imageFileNameDic->path()->c_str();
     listView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
     
     
     if (backGroundScale9Enabled)
     {
         auto f_capInsets = options->capInsets();
         Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
         listView->setBackGroundImageCapInsets(capInsets);
         
         auto f_scale9Size = options->scale9Size();
         Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
         listView->setContentSize(scale9Size);
     }
     
     auto widgetOptions = options->widgetOptions();
     auto f_color = widgetOptions->color();
     Color3B color(f_color->r(), f_color->g(), f_color->b());
     listView->setColor(color);
     
     int opacity = widgetOptions->alpha();
     listView->setOpacity(opacity);
     
     auto f_innerSize = options->innerSize();
     Size innerSize(f_innerSize->width(), f_innerSize->height());
     listView->setInnerContainerSize(innerSize);
     int direction = options->direction();
     listView->setDirection((ScrollView::Direction)direction);
     bool bounceEnabled = options->bounceEnabled();
     listView->setBounceEnabled(bounceEnabled);
     
     int gravityValue = options->gravity();
     ListView::Gravity gravity = (ListView::Gravity)gravityValue;
     listView->setGravity(gravity);
     
     float itemMargin = options->itemMargin();
     listView->setItemsMargin(itemMargin);
     
     
     auto widgetReader = WidgetReader::getInstance();
     widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
     
 }
开发者ID:franklen,项目名称:ParticleBuilder,代码行数:78,代码来源:ListViewReader.cpp

示例2: setPropsWithFlatBuffers

    void ListViewReader::setPropsWithFlatBuffers(cocos2d::Node *node, const flatbuffers::Table *listViewOptions)
    {
        ListView* listView = static_cast<ListView*>(node);
        auto options = (ListViewOptions*)listViewOptions;
        
        bool clipEnabled = options->clipEnabled();
        listView->setClippingEnabled(clipEnabled);
        
        bool backGroundScale9Enabled = options->backGroundScale9Enabled();
        listView->setBackGroundImageScale9Enabled(backGroundScale9Enabled);
        
        
        auto f_bgColor = options->bgColor();
        Color3B bgColor(f_bgColor->r(), f_bgColor->g(), f_bgColor->b());
        auto f_bgStartColor = options->bgStartColor();
        Color3B bgStartColor(f_bgStartColor->r(), f_bgStartColor->g(), f_bgStartColor->b());
        auto f_bgEndColor = options->bgEndColor();
        Color3B bgEndColor(f_bgEndColor->r(), f_bgEndColor->g(), f_bgEndColor->b());
        
        auto f_colorVecor = options->colorVector();
        Vec2 colorVector(f_colorVecor->vectorX(), f_colorVecor->vectorY());
        listView->setBackGroundColorVector(colorVector);
        
        int bgColorOpacity = options->bgColorOpacity();
        
        int colorType = options->colorType();
        listView->setBackGroundColorType(Layout::BackGroundColorType(colorType));
        
        listView->setBackGroundColor(bgStartColor, bgEndColor);
        listView->setBackGroundColor(bgColor);
        listView->setBackGroundColorOpacity(bgColorOpacity);
        
        
        auto imageFileNameDic = options->backGroundImageData();
        int imageFileNameType = imageFileNameDic->resourceType();
        std::string imageFileName = imageFileNameDic->path()->c_str();
        listView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
        
        auto widgetOptions = options->widgetOptions();
        auto f_color = widgetOptions->color();
        Color3B color(f_color->r(), f_color->g(), f_color->b());
        listView->setColor(color);
        
        int opacity = widgetOptions->alpha();
        listView->setOpacity(opacity);
        
        auto f_innerSize = options->innerSize();
        Size innerSize(f_innerSize->width(), f_innerSize->height());
        listView->setInnerContainerSize(innerSize);
        bool bounceEnabled = options->bounceEnabled();
        listView->setBounceEnabled(bounceEnabled);
        
        std::string directionType = options->directionType()->c_str();
        if (directionType == "")
        {
            listView->setDirection(ListView::Direction::HORIZONTAL);
            std::string verticalType = options->verticalType()->c_str();
            if (verticalType == "")
            {
                listView->setGravity(ListView::Gravity::TOP);
            } 
            else if (verticalType == "Align_Bottom")
            {
                listView->setGravity(ListView::Gravity::BOTTOM);
            }
            else if (verticalType == "Align_VerticalCenter")
            {
                listView->setGravity(ListView::Gravity::CENTER_VERTICAL);
            }
        } 
        else if (directionType == "Vertical")
        {
            listView->setDirection(ListView::Direction::VERTICAL);
            std::string horizontalType = options->horizontalType()->c_str();
            if (horizontalType == "")
            {
                listView->setGravity(ListView::Gravity::LEFT);
            }
            else if (horizontalType == "Align_Right")
            {
                listView->setGravity(ListView::Gravity::RIGHT);
            }
            else if (horizontalType == "Align_HorizontalCenter")
            {
                listView->setGravity(ListView::Gravity::CENTER_HORIZONTAL);
            }
        }
        
        float itemMargin = options->itemMargin();
        listView->setItemsMargin(itemMargin);

        auto widgetReader = WidgetReader::getInstance();
        widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
        
        if (backGroundScale9Enabled)
        {
            auto f_capInsets = options->capInsets();
            Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
            listView->setBackGroundImageCapInsets(capInsets);
            
//.........这里部分代码省略.........
开发者ID:1097195326,项目名称:GameAreas,代码行数:101,代码来源:ListViewReader.cpp


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