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


C++ BaseSprite::getScale方法代码示例

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


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

示例1: getItemContentByIndex

BaseSprite* MainLayerZhuangBeiBaseBody::getItemContentByIndex(unsigned int index)
{
    BaseSprite* bg = BaseSprite::create("mianban_zhuangbei_xiangxi.png");

    CCString tempStr;

    CCPoint picPos = ccp(75.0f, bg->getContentSize().height/2);

    {
        ImageData diWenData = ImageManager::getManager()->getImageData_DiWen_List(
                                  mEquipmentVec[index]->getEquipColor(),
                                  false,
                                  mEquipmentVec[index]->isPartOfSuit(),
                                  mEquipmentVec[index]->haveZhuanke());
        BaseSprite* diWen = BaseSprite::create(diWenData.getCurrentImageFile());
        diWen->setScale(diWenData.scale);
        diWen->setPosition(picPos);
        bg->addChild(diWen,0,TAG_BaseBody_TABLE_ITEM_DiWen);

        {
            BaseSprite *sprite = ImageManager::getManager()->getSpriteOfZhuangbei(mEquipmentVec[index],true,true);
            //sprite->setScale(data.scale);
            sprite->setScale(0.43f);
            sprite->setPosition(picPos);
            bg->addChild(sprite,0,TAG_BaseBody_TABLE_ITEM_Image);
        }

        //封印
        if (mEquipmentVec[index]->isInFengYin())
        {
            BaseSprite *fyImg = BaseSprite::create("shenbing_fengyin_suo.png");
            bg->addChild(fyImg, 0, TAG_BaseBody_TABLE_FengYin_Img);
            fyImg->setPosition(diWen->getPosition());
            fyImg->setScale(diWen->getContentSize().width*diWen->getScale() / fyImg->getContentSize().width);
        }

    }

    // 添加图片识别区
    {
        ImageData selecedData = ImageManager::getManager()->getImageData_DiWen_Selected(
                                    mEquipmentVec[index]->getEquipColor(),
                                    false,//mEquipmentVec[index]->isShenBing(),
                                    mEquipmentVec[index]->isPartOfSuit());
        BaseSprite* menuItemSel = BaseSprite::create(selecedData.getCurrentImageFile());
        menuItemSel->setScale(selecedData.scale);
        CCSprite* menuRect = CCSprite::createWithTexture(menuItemSel->getTexture());
        menuRect->setScale(0.0f);

        FXScrollMenu *menu = FXScrollMenu::create(
                                 mTableView->getParent()->convertToWorldSpace(mTableView->getPosition()), mTableView->getViewSize());
        bg->addChild(menu, 0, TAG_BaseBody_MENU);
        menu->setPosition(ccp(0,0));
        CCMenuItemSprite* t = CCMenuItemSprite::create(menuRect,menuItemSel,this,SEL_MenuHandler(&MainLayerZhuangBeiBaseBody::itemImageClicked));
        menu->addChild(t, 0, index);
        t->setPosition(picPos);
    }

    float left_x_start = 160 - 4;
    //名称
    {
        CCLabelTTF* label;
        char str[64];
        if (mEquipmentVec[index]->getEquipData().qianghua_data.qianghua_count != 0)
        {
            sprintf(str, "%s", mEquipmentVec[index]->getName().c_str());
        }
        else
        {
            sprintf(str, "%s", mEquipmentVec[index]->getName().c_str());
        }

        label = LF::lable(bg,str,ccp(left_x_start,190),24,fontStr_kaiti);
        label->setTag(TAG_BaseBody_LABLE_NAME);
        ccColor3B color = ImageManager::getManager()->getShowColor(mEquipmentVec[index]->getEquipColor(),false,mEquipmentVec[index]->isPartOfSuit());
        label->setColor(color);
    }

    //类型
    {
        std::string typeStr =
            CS::getZhuangbeiTypeName(mEquipmentVec[index]->getType(), mEquipmentVec[index]->getEquipColor());

        CCLabelTTF* label;
        label = LF::lable(bg,typeStr,ccp(left_x_start,165),18,fontStr_kaiti);
        label->setTag(TAG_BaseBody_LABLE_TYPE);
        label->setColor(fonColor_CiYao);
    }

    //白字
    {
        CCLabelTTF* label_baizhi = NULL;
        bool hasBaiZhi = false;
        {
            float baizi = 0;
            switch(mEquipmentVec[index]->getType())
            {
            case ZhuangbeiType_DanshouJian:
            case ZhuangbeiType_ShuangshouBishou:
            case ZhuangbeiType_ShuangshouFu:
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MainLayerZhuangBeiBaseBody.cpp


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