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


C++ LoadingBar::getPercent方法代码示例

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


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

示例1: setPropsFromBinary

 void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
 {
     WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
     
     LoadingBar* loadingBar = static_cast<LoadingBar*>(widget);
     this->beginSetBasicProperties(widget);
     float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
     int percent = loadingBar->getPercent();
     
     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) {
             loadingBar->setScale9Enabled(valueToBool(value));
         }
         else if (key == P_TextureData){
             
             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);
             
             loadingBar->loadTexture(backgroundValue, imageFileNameType);
             
         }
         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);
         }else if(key == P_Direction){
             loadingBar->setDirection((LoadingBar::Direction)valueToInt(value));
         }else if(key == P_Percent){
             percent = valueToInt(value);
         }
         
     } //end of for loop
     
     if (loadingBar->isScale9Enabled()) {
         loadingBar->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
     }
     loadingBar->setPercent(percent);
     this->endSetBasicProperties(widget);
 }
开发者ID:289,项目名称:DouPo,代码行数:57,代码来源:LoadingBarReader.cpp

示例2: LoadingBarUpdate

void UI::LoadingBarUpdate(float dt){
    LoadingBar *lb =dynamic_cast<LoadingBar*>(getChildByTag(1));
    CCASSERT(lb, "the childer with tag 1 is not a loadingBar Class");
    float per=lb->getPercent()+0.5f;
    lb->setPercent(per);
    if (per>=100) {
        per=100;
        unschedule("LoadingBarUpdate");
    }
}
开发者ID:baokuanze,项目名称:UIdemo,代码行数:10,代码来源:UI.cpp


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