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


C++ DiString::Format方法代码示例

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


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

示例1: NotifyPointMove

    void CurveEditor::NotifyPointMove(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
    {
        if (_id != MyGUI::MouseButton::Left)
            return;

        if (!CheckPosition(_left, _top))
            return;

        auto pos = MyGUI::IntPoint(_left, _top) - _sender->getCroppedParent()->getAbsolutePosition();
        auto value = GetValue(pos.left, pos.top);

        pos.left -= 7;
        pos.top -= 7;
        _sender->setPosition(pos);

        DiString str;
        str.Format("%.3g", value.x);
        mEditTimeEditBox->setCaption(str.c_str());
        str.Format("%.3g", value.y);
        mEditValueEditBox->setCaption(str.c_str());

        std::sort(mButtons.begin(), mButtons.end(),
            [](MyGUI::Button* a, MyGUI::Button* b) {
            return a->getPosition().left < b->getPosition().left;
        });

        RefreshCurve();
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:28,代码来源:CurveEditor.cpp

示例2: CreateShadowTextures

    void DiLight::CreateShadowTextures(DiSceneManager* sm)
    {
        mShadowTextures.resize(mShadowConfig.size());
        mShadowCameras.resize(mShadowConfig.size());
        
        for (size_t i = 0; i < mShadowConfig.size(); ++i)
        {
            static int st = 0;
            DiString camname;
            camname.Format("_shad_cam_%d", st);
            DiString name;
            name.Format("_shad_tex_%d", st++);
            
            mShadowTextures[i] = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiTexture>(name);
            mShadowTextures[i]->SetDimensions(mShadowConfig[i].width, mShadowConfig[i].height);
            mShadowTextures[i]->SetFormat(mShadowConfig[i].format);
            mShadowTextures[i]->SetUsage(TU_RENDER_TARGET);
            mShadowTextures[i]->SetAddressing(AM_CLAMP);
            mShadowTextures[i]->CreateTexture();
            auto rt = mShadowTextures[i]->GetRenderTarget();
            
            rt->SetFlippingUV(true);
            rt->SetClearColor(DiColor::White);
            
            DiCamera* cam = sm->CreateCamera(camname);
			cam->SetAspectRatio((float)mShadowConfig[i].width / (float)mShadowConfig[i].height);
            mShadowCameras[i] = cam;
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:29,代码来源:Light.cpp

示例3: SetAttribute

 void CurveEditor::SetAttribute(DiAttributeCurved& rhs)
 {
     rhs.CopyTo(&mCurvedAttr);
     
     mSplineButton->setStateSelected(mCurvedAttr.GetInterpolationType() == IT_SPLINE);
     
     // delete all buttons
     for (auto i : mButtons)
         mCanvasWidget->_destroyChildWidget(i);
     mButtons.clear();
     
     auto& pts = mCurvedAttr.GetControlPoints();
     float minVal = 0;
     float maxVal = 10;
     
     // calculate the range
     for (auto p : pts)
     {
         minVal = DiMath::Min(minVal, p.y);
         maxVal = DiMath::Max(maxVal, p.y);
     }
     
     float defaultRangeMin = 0;
     float defaultRangeMax = 10;
     
     if(minVal < 0)
     {
         int v = minVal / 10 - 1;
         minVal = v * 10;
     }
     
     if(maxVal > 10)
     {
         int v = maxVal / 10 + 1;
         maxVal = v * 10;
     }
     
     DiString temp;
     temp.Format("%g", minVal);
     mRangeMinEditBox->setCaption(temp.c_str());
     
     temp.Format("%g", maxVal);
     mRangeMaxEditBox->setCaption(temp.c_str());
     
     RefreshRange();
     
     // add buttons
     for (auto p : pts)
     {
         auto point = GetButtonPoint(p);
         AddButton(point.left, point.top);
     }
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:53,代码来源:CurveEditor.cpp

示例4: RefreshNumbers

    void CurveEditor::RefreshNumbers()
    {
        DeleteNumbersY();

        auto size = mCurveCanvasWidget->getSize();
        auto width = size.width;
        auto height = size.height;

        auto inteveralX = width / (gridNumX + 2);
        auto inteveralY = height / (gridNumY + 2);

        float step = (mValueRange.y - mValueRange.x) / gridNumY;
        
        for (auto i = 0; i <= gridNumY; i += 2)
        {
            MyGUI::TextBox* text = mCurveCanvasWidget->createWidget<MyGUI::TextBox>("TextBox",
                MyGUI::IntCoord(3, i * inteveralY + 5, 30, 15), MyGUI::Align::Default);
            text->setFontHeight(14);
            text->setTextShadow(true);
            text->setTextShadowColour(MyGUI::Colour::Black);
            DiString s;
            s.Format("%.1f", step*(gridNumY - i) + mValueRange.x);
            text->setCaption(s.c_str());
            mNumbersY.push_back(text);
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:26,代码来源:CurveEditor.cpp

示例5: GenerateControllerName

 DiString DiEditorManager::GenerateControllerName(const DiString& type)
 {
     static int id = 0;
     DiString ret;
     ret.Format("%s_%d", type.c_str(), id++);
     return ret;
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:7,代码来源:EditorManager.cpp

示例6: GenerateRefModelName

 DiString DiEditorManager::GenerateRefModelName()
 {
     static int id = 0;
     DiString ret;
     ret.Format("Model_%d", id++);
     return ret;
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:7,代码来源:EditorManager.cpp

示例7: GenerateElementName

 DiString DiEditorManager::GenerateElementName()
 {
     static int id = 0;
     DiString ret;
     ret.Format("Element_%d", id++);
     return ret;
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:7,代码来源:EditorManager.cpp

示例8: GenerateSystemName

 DiString DiEditorManager::GenerateSystemName()
 {
     static int id = 0;
     DiString ret;
     ret.Format("ParticleSystem_%d", id++);
     return ret;
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:7,代码来源:EditorManager.cpp

示例9: CreateMaterial

    void DiFoliageLayer::CreateMaterial()
    {
        DiString uniqueStr;
        static int uq = 0;
        uniqueStr.Format("_fol_mat_%d",uq++);

        DiCompileDesc desc;
        desc.entryName = "vs_main";
        desc.profile = DiShaderProgram::GetDefaultVsProfile();

        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_FADE_ALPHA"        ,"0"));
        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_FADE_GROW"        ,"1"));
        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_FADE_ALPHA_GROW","2"));

        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_LIGHTING"        ,"0"));
        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_ANIMATE"        ,"0"));
        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_BLEND"            ,"0"));
        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_FADE_TECH"        ,"0"));
        desc.marcos.push_back(DiPair<DiString,DiString>("_GRASS_RENDER_TECH"    ,"0"));

        mMaterial = DiAssetManager::GetInstance().CreateManualAsset<DiMaterial>(uniqueStr);

        mMaterial->SetBlendMode(BLEND_ALPHA);
        mMaterial->SetCullMode(CULL_NONE);

        mMaterial->LoadVertexShader("grass.vsh");
        mMaterial->LoadPixelShader("unlighting_diffuse_color.psh");

        mNeedUpdateMaterial = true;
    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:30,代码来源:FoliageLayer.cpp

示例10: Update

    void DiInfo::Update(float delta)
    {
        //Change("FPS", 1.0f / delta);

        if (mInfo != nullptr)
        {
            //std::ostringstream stream;
            //for (MyGUI::VectorStringPairs::iterator iter = mParams.begin(); iter != mParams.end(); ++iter)
            //{
            //    if (iter != mParams.begin())
            //        stream << "\n";
            //    stream << iter->first << " :\t" << iter->second;
            //}

            //mInfo->setCaption(stream.str());
            DiString info = DiProfiler::GetInstancePtr()->GetData();
            DiString fps;
            fps.Format("\nFPS: %f", 1.0f / delta);
            info += fps;
            mInfo->setCaption(info.c_str());

            DI_PROFILE_BEGIN_INTERVAL

            MyGUI::ISubWidgetText* text = mInfo->getSubWidgetText();
            if (text != nullptr)
            {
                const MyGUI::IntSize& size = text->getTextSize() + mInfo->getSize() - text->getSize();
                const MyGUI::IntSize& size_view = MyGUI::RenderManager::getInstance().getViewSize();
                mInfo->setCoord(10, 10, size.width, size.height);
            }
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:32,代码来源:Info.cpp

示例11: InitGrid

    void CurveEditor::InitGrid()
    {
        auto size = mCurveCanvasWidget->getSize();
        auto width = size.width;
        auto height= size.height;

        auto inteveralX = width / (gridNumX + 2);
        auto inteveralY = height / (gridNumY + 2);

        MyGUI::Colour dark(0.1f, 0.1f, 0.1f);
        MyGUI::Colour light(0.2f, 0.2f, 0.2f);

        std::vector<MyGUI::Colour> colors;
        std::vector<MyGUI::FloatPoint> lines;
        for (auto i = 1; i <= gridNumX+1; ++i)
        {
            lines.push_back(MyGUI::FloatPoint(i*inteveralX, 3));
            lines.push_back(MyGUI::FloatPoint(i*inteveralX, height-4));

            colors.push_back(i == 1 ? dark : light);
            colors.push_back(i == 1 ? dark : light);
        }

        lines.push_back(MyGUI::FloatPoint(inteveralX - 1, 3));
        lines.push_back(MyGUI::FloatPoint(inteveralX - 1, height - 4));
        colors.push_back(dark);
        colors.push_back(dark);

        for (auto i = 1; i <= gridNumY + 1; ++i)
        {
            lines.push_back(MyGUI::FloatPoint(3, i*inteveralY));
            lines.push_back(MyGUI::FloatPoint(width - 4, i*inteveralY));

            colors.push_back(i == gridNumY + 1 ? dark : light);
            colors.push_back(i == gridNumY + 1 ? dark : light);
        }

        lines.push_back(MyGUI::FloatPoint(3, (gridNumY + 1)*inteveralY + 1));
        lines.push_back(MyGUI::FloatPoint(width - 4, (gridNumY + 1)*inteveralY + 1));
        colors.push_back(dark);
        colors.push_back(dark);

        mCurveLines->setPoints(lines, true);
        mCurveLines->setColors(colors);

        for (auto i = 1; i <= gridNumX + 1; i += 2)
        {
            MyGUI::TextBox* text = mCurveCanvasWidget->createWidget<MyGUI::TextBox>("TextBox",
                MyGUI::IntCoord(i * inteveralX + 2, height - 19, 30, 15), MyGUI::Align::Default);
            text->setFontHeight(14);
            text->setTextShadow(true);
            text->setTextShadowColour(MyGUI::Colour::Black);
            DiString s;
            s.Format("%.1f", (i - 1) / (float)gridNumX);
            text->setCaption(s.c_str());
            mNumbersX.push_back(text);
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:58,代码来源:CurveEditor.cpp

示例12: SetCurrentFileName

 void DiEditorManager::SetCurrentFileName(const DiString& name)
 {
     mFxFileName = name;
     
     DiString title = "Hon Fxer";
     if(!name.empty())
         title.Format("Hon Fxer - %s",name.ExtractFileName().c_str());
     
     DiBase::Driver->GetMainRenderWindow()->GetWindow()->SetTitle(title.c_str());
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:10,代码来源:EditorManager.cpp

示例13: BuildNewBatch

    DiInstanceBatchPtr DiInstanceManager::BuildNewBatch(const DiString& materialName, bool firstTime)
    {
        DiSubMesh::IndexMap &idxMap = mMeshReference->GetSubMesh(mSubMeshIdx)->GetBlendIndexToBoneIndexMap();
        //idxMap = idxMap.empty() ? mMeshReference->sharedBlendIndexToBoneIndexMap : idxMap;

        DiMaterialPtr mat = DiAssetManager::GetInstance().GetAsset<DiMaterial>( materialName );

        InstanceBatchVec &materialInstanceBatch = mInstanceBatches[materialName];

        DiInstanceBatchPtr batch;

        DiString name;
        name.Format("%s_InstanceBatch_%d",mName.c_str(),mIdCount++);

        switch( mInstancingTechnique )
        {
        case INSTANCE_SHADER_BASED:
            batch = make_shared<DiInstanceBatchShader>( this, mMeshReference, mMotionReference, mat, mInstancesPerBatch,
                &idxMap, name );
            break;
        case INSTANCE_HARDWARE_BASED:
            batch = make_shared<DiInstanceBatchHardware>(this, mMeshReference, mat, mInstancesPerBatch,
                name );
            break;
        default:
            DI_ERROR("Unsupported instanced technique.");
            break;
        }

        if( !firstTime )
        {
            batch->BuildFrom( mMeshReference->GetSubMesh(mSubMeshIdx) );
        }
        else
        {
            const size_t maxInstPerBatch = batch->CalculateMaxNumInstances( mMeshReference->
                GetSubMesh(mSubMeshIdx) );
            mInstancesPerBatch = DiMath::Min( maxInstPerBatch, mInstancesPerBatch );
            batch->SetInstancesPerBatch( mInstancesPerBatch );

            batch->Build( mMeshReference->GetSubMesh(mSubMeshIdx) );
        }

        //const BatchSettings &batchSettings = mBatchSettings[materialName];
        //batch->SetCastShadows( batchSettings.setting[CAST_SHADOWS] );

        DiCullNode *sceneNode = mSceneManager->GetRootNode()->CreateChild();
        sceneNode->AttachObject( batch );

        materialInstanceBatch.push_back( batch );

        return batch;
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:53,代码来源:InstanceManager.cpp

示例14: QuickCreate

    DiMaterialPtr DiMaterial::QuickCreate( const DiString& vs, const DiString& ps , uint64 flag)
    {
        static int quickcreateID = 0;
        DiString name;
        name.Format("quick_%d", quickcreateID++);
        DiMaterialPtr mat = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiMaterial>(name);

        mat->SetShaderFlag(flag);
        mat->LoadShader(vs,ps);

        return mat;
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:12,代码来源:Material.cpp

示例15: updateInfo

    void RenderWindowControl::updateInfo()
    {
        auto model = HonViewerApp::GetViewerApp()->GetModelViewer();
        if (!model)
            return;

        int numVerts = model->GetNumVertices();
        int numFaces = model->GetNumFaces();
        int numSubMods = model->GetNumSubModels();
        int numBones = model->GetNumBones();

        DiString info;
        info.Format("%d\n%d\n%d\n%d", numVerts, numFaces, numSubMods, numBones);
        mInfo->setCaption(info.c_str());
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:15,代码来源:RenderWindowControl.cpp


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