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


C++ TextAtlas::setProperty方法代码示例

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


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

示例1: setPropsWithFlatBuffers

 void TextAtlasReader::setPropsWithFlatBuffers(cocos2d::Node *node, const flatbuffers::Table *textAtlasOptions)
 {
     TextAtlas* labelAtlas = static_cast<TextAtlas*>(node);
     auto options = (TextAtlasOptions*)textAtlasOptions;
     
     auto cmftDic = options->charMapFileData();
     int cmfType = cmftDic->resourceType();
     switch (cmfType)
     {
         case 0:
         {
             const char* cmfPath = cmftDic->path()->c_str();
             std::string stringValue = options->stringValue()->c_str();
             int itemWidth = options->itemWidth();
             int itemHeight = options->itemHeight();
             labelAtlas->setProperty(stringValue,
                                     cmfPath,
                                     itemWidth,
                                     itemHeight,
                                     options->startCharMap()->c_str());
             break;
         }
         case 1:
             CCLOG("Wrong res type of LabelAtlas!");
             break;
         default:
             break;
     }
     
     auto widgetReader = WidgetReader::getInstance();
     widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
     
 }
开发者ID:1097195326,项目名称:GameAreas,代码行数:33,代码来源:TextAtlasReader.cpp

示例2: setPropsWithFlatBuffers

 void TextAtlasReader::setPropsWithFlatBuffers(cocos2d::Node *node, const flatbuffers::Table *textAtlasOptions)
 {
     TextAtlas* labelAtlas = static_cast<TextAtlas*>(node);
     auto options = (TextAtlasOptions*)textAtlasOptions;
     
     auto cmftDic = options->charMapFileData();
     int cmfType = cmftDic->resourceType();
     switch (cmfType)
     {
         case 0:
         {
             const char* cmfPath = cmftDic->path()->c_str();
             
             bool fileExist = false;
             std::string errorFilePath = "";
             
             if (FileUtils::getInstance()->isFileExist(cmfPath))
             {
                 fileExist = true;
                 
                 std::string stringValue = options->stringValue()->c_str();
                 int itemWidth = options->itemWidth();
                 int itemHeight = options->itemHeight();
                 labelAtlas->setProperty(stringValue,
                                         cmfPath,
                                         itemWidth,
                                         itemHeight,
                                         options->startCharMap()->c_str());
             }
             else
             {
                 errorFilePath = cmfPath;
                 fileExist = false;
             }
             
             //if (!fileExist)
             //{
             //    auto label = Label::create();
             //    label->setString(__String::createWithFormat("%s missed", errorFilePath.c_str())->getCString());
             //    labelAtlas->addChild(label);
             //}
             break;
         }
             
         case 1:
             CCLOG("Wrong res type of LabelAtlas!");
             break;
             
         default:
             break;
     }
     
     auto widgetReader = WidgetReader::getInstance();
     widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
     
     labelAtlas->ignoreContentAdaptWithSize(true);
     
 }
开发者ID:1005491398,项目名称:Threes,代码行数:58,代码来源:TextAtlasReader.cpp

示例3: setPropsFromBinary

    void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
    {
        this->beginSetBasicProperties(widget);
        
        TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);

        
        stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
        Widget::TextureResType type;
        std::string charMapFileName;
        std::string stringValue;
        std::string startCharMap;
        float itemWidth;
        float itemHeight;
        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_StringValue) {
                stringValue = value;
            }
            else if(key == P_CharMapFileData){
                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);
                
                charMapFileName = backgroundValue;
                type  = imageFileNameType;
                
            }else if(key == P_ItemWidth){
                itemWidth = valueToFloat(value);
            }else if(key == P_ItemHeight){
                itemHeight = valueToFloat(value);
            }else if(key == P_StartCharMap){
                startCharMap = value;
            }
        } //end of for loop
        
        if (type == (Widget::TextureResType)0) {
            labelAtlas->setProperty(stringValue, charMapFileName, itemWidth, itemHeight, startCharMap);
        }
        this->endSetBasicProperties(widget);
    }
开发者ID:1005491398,项目名称:Threes,代码行数:51,代码来源:TextAtlasReader.cpp

示例4: create

TextAtlas* TextAtlas::create(const std::string &stringValue,
                             const std::string &charMapFile,
                             int itemWidth,
                             int itemHeight,
                             const std::string &startCharMap)
{
    TextAtlas* widget = new TextAtlas();
    if (widget && widget->init())
    {
        widget->autorelease();
        widget->setProperty(stringValue, charMapFile, itemWidth, itemHeight, startCharMap);
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return nullptr;
}
开发者ID:2276225819,项目名称:Game,代码行数:16,代码来源:UITextAtlas.cpp

示例5: setPropsFromJsonDictionary

    void TextAtlasReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
    {
        WidgetReader::setPropsFromJsonDictionary(widget, options);
        
        
        std::string jsonPath = GUIReader::getInstance()->getFilePath();
        
        TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
//        bool sv = DICTOOL->checkObjectExist_json(options, P_StringValue);
//        bool cmf = DICTOOL->checkObjectExist_json(options, P_CharMapFile);
//        bool iw = DICTOOL->checkObjectExist_json(options, P_ItemWidth);
//        bool ih = DICTOOL->checkObjectExist_json(options, P_ItemHeight);
//        bool scm = DICTOOL->checkObjectExist_json(options, P_StartCharMap);
       
        const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, P_CharMapFileData);
        int cmfType = DICTOOL->getIntValue_json(cmftDic, P_ResourceType);
        switch (cmfType)
        {
            case 0:
            {
                std::string tp_c = jsonPath;
                const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, P_Path);
                const char* cmf_tp = tp_c.append(cmfPath).c_str();
                labelAtlas->setProperty(DICTOOL->getStringValue_json(options, P_StringValue,"12345678"),
                                        cmf_tp,
                                        DICTOOL->getIntValue_json(options, P_ItemWidth,24),
                                        DICTOOL->getIntValue_json(options,P_ItemHeight,32),
                                        DICTOOL->getStringValue_json(options, P_StartCharMap));
                break;
            }
            case 1:
                CCLOG("Wrong res type of LabelAtlas!");
                break;
            default:
                break;
        }
        
        
        
        WidgetReader::setColorPropsFromJsonDictionary(widget, options);
    }        
开发者ID:1005491398,项目名称:Threes,代码行数:41,代码来源:TextAtlasReader.cpp


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