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


C++ DiString类代码示例

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


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

示例1: an

    DiTexturePtr DiShaderParameter::WriteTexture2D( const DiString& name, 
        const DiString& textureName )
    {
        DiString texfile = textureName;
#if DEMI_PLATFORM == DEMI_PLATFORM_IOS
        if(texfile.CheckFileExtension("dds"))
            texfile = texfile.ExtractBaseName() + ".pvr";
#endif
        
        //DI_LOG("Writing 2d texture name: %s, %s [%x]", name.c_str(), textureName.c_str(),this);
        
        DiAssetManager& assetMgr = DiAssetManager::GetInstance();
        DiTexturePtr textureAsset = assetMgr.GetAsset<DiTexture>(texfile);

        if (!textureAsset)
        {
            textureAsset = DiTexture::GetDefaultTexture();
            DI_WARNING("Cannot write the texture(%s), using default texture", texfile.c_str());
        }

        auto it = mShaderParams[VARIABLE_SAMPLER2D].find(name);
        if (it != mShaderParams[VARIABLE_SAMPLER2D].end())
        {
            DiTexture* tex = textureAsset.get();
            DiAny an(tex);
            it->second = an;
        }
        return textureAsset;
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:29,代码来源:ShaderParam.cpp

示例2: ReadString

    void DiMotionSerializerImpl::ReadAttachParents( DiDataStreamPtr& stream,DiAttachSet* attachset,DiSkeleton* skeleton )
    {
        DiString strChildName = ReadString(stream);
        DiString strParentName = ReadString(stream);

        DiNode* son = attachset->GetAttachNode(strChildName);
        DiNode* parent = NULL;
        parent = attachset->GetAttachNode(strParentName);

        if(!parent && skeleton)
        {
            if(skeleton->HasBone(strParentName))
            {
                parent = skeleton->GetBone(strParentName);
            }
        }

        if(parent)
        {
            parent->AddChild(son);
        }
        else
        {
            DI_WARNING("No parent : %s",strParentName.c_str());
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:26,代码来源:MotionSerial.cpp

示例3: WriteTextureCUBE

    DiTexturePtr DiShaderParameter::WriteTextureCUBE( const DiString& name, 
        const DiString& textureName )
    {
        DiString texfile = textureName;
#if DEMI_PLATFORM == DEMI_PLATFORM_IOS
        if(texfile.CheckFileExtension("dds"))
            texfile = texfile.ExtractBaseName() + ".pvr";
#endif
        
        DiAssetManager& assetMgr = DiAssetManager::GetInstance();
        DiTexturePtr textureAsset = assetMgr.GetAsset<DiTexture>(texfile);

        if (!textureAsset)
        {
            DI_WARNING("Failed to load the textureCUBE resource : %s",texfile.c_str());
            return DiTexturePtr();
        }

        auto it = mShaderParams[VARIABLE_SAMPLERCUBE].find(name);
        if (it != mShaderParams[VARIABLE_SAMPLERCUBE].end())
        {
            DiTexture* tex = textureAsset.get();
            DiAny an(tex);
            it->second = an;
        }
        return textureAsset;
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:27,代码来源:ShaderParam.cpp

示例4: 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

示例5: 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

示例6: 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

示例7: GetValue

    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

示例8: notifyOk

    void SetGameLocWindow::notifyOk(MyGUI::Widget* _sender)
	{
        auto gameloc = mTextLocation->getCaption();
        DiString exeFile = gameloc.asUTF8_c_str();
        exeFile += "/";
#if DEMI_PLATFORM == DEMI_PLATFORM_WIN32
        exeFile += "hon.exe";
#else
        exeFile += "hon";
#endif
        if (DiPathLib::FileExisted(exeFile))
        {
            DiString path = gameloc.asUTF8_c_str();
            DiString respack = path + "/game/resources0.s2z";
            DiString texpack = path + "/game/textures.s2z";
            HonViewerApp::GetViewerApp()->SetResourceLocation(respack, texpack);

            SettingsManager::getInstance().getSector("Settings")->setPropertyValue("ResourcePack", respack.c_str());
            SettingsManager::getInstance().getSector("Settings")->setPropertyValue("TexturePack", texpack.c_str());
        }
        else
        {
            MyGUI::Message::createMessageBox("Message", "Invalid HON game folder",
                "Cannot locate executable file of HON",
                MyGUI::MessageBoxStyle::Ok | MyGUI::MessageBoxStyle::IconError);
        }

        eventEndDialog(this, true);
	}
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:29,代码来源:SetGameLocationWindow.cpp

示例9: GetK2MediaPath

    DiDataStreamPtr DiK2Configs::GetDataStream(const DiString& relPath, K2ResourceType type)
    {
#ifdef _K2_RECORD_USED_RESOURCE
        sUsedResources.insert(relPath);
#endif

        DiString full = GetK2MediaPath(relPath, type == K2_RES_TEXTURE);

        if (RESOURCE_PACK)
        {
            DiDataStreamPtr data = RESOURCE_PACK->Open(full);
            return data;
        }
        else
        {
            // now we just simply using OS's file system
            FILE* fp = fopen(full.c_str(), type == K2_RES_XML ? "r" : "rb");
            if (!fp)
            {
                DI_WARNING("Cannot open the file: %s", full.c_str());
                return nullptr;
            }
            DiDataStreamPtr data(DI_NEW DiFileHandleDataStream(fp));
            return data;
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:26,代码来源:K2Configs.cpp

示例10: GenerateElementName

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

示例11: OutputLog

    void DiConsoleLogger::OutputLog(const char* szMessage, const char* levelInfo)
    {
        static DiLogInfo logInfo;
        if (::IsWindow(mWnd))
        {
            DiString msg = szMessage;
            DiString lv = levelInfo;

            logInfo.type = LOG_LEVEL_LOG;
            if (lv == "error")
                logInfo.type = LOG_LEVEL_ERROR;
            else if (lv == "info")
                logInfo.type = LOG_LEVEL_LOG;
            else if (lv == "debug")
                logInfo.type = LOG_LEVEL_DEBUG;
            else if (lv == "warning")
                logInfo.type = LOG_LEVEL_WARNING;
            else
                logInfo.type = 0xFFFF;

            if (Driver)
                logInfo.hwnd = mMainHwnd;

            ZeroMemory(logInfo.message, sizeof(logInfo.message));
            strcpy_s(logInfo.message, 4096, msg.c_str());
            COPYDATASTRUCT cpd;
            cpd.dwData = 0;
            cpd.cbData = sizeof(logInfo);
            cpd.lpData = &logInfo;
            ::SendMessage(mWnd, WM_COPYDATA, 0, (LPARAM)(LPVOID)&cpd);
        }
    }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:32,代码来源:Console.cpp

示例12: GenerateSystemName

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

示例13: GenerateRefModelName

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

示例14: Command_ToolNew

 void DiEditorManager::Command_ToolNew(const MyGUI::UString& _commandName, bool& _result)
 {
     DiString msg;
     
     if (!mFxFileName.empty())
         msg = "Do you want to keep the new effects?";
     else
         msg = "Do you want to save the effects?";
     
     auto msgBox = MyGUI::Message::createMessageBox("Message", "New",
                                                 msg.c_str(),
                                                 MyGUI::MessageBoxStyle::Yes|MyGUI::MessageBoxStyle::No|
                                                 MyGUI::MessageBoxStyle::Cancel|MyGUI::MessageBoxStyle::IconDefault);
     
     msgBox->eventMessageBoxResultLambda = [this](MyGUI::Message*, MyGUI::MessageBoxStyle style){
         if(style == MyGUI::MessageBoxStyle::Yes)
         {
             SaveAll();
             NewFx();
         }
         else if(style == MyGUI::MessageBoxStyle::No)
         {
             NewFx();
         }
     };
     _result = true;
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:27,代码来源:EditorManager.cpp

示例15: DI_SERIAL_LOG

    void DiMeshSerializerImpl::ReadSubMesh( DiDataStreamPtr& stream, DiMesh* pMesh )
    {
        DI_SERIAL_LOG("Reading submesh..");

        DiSubMesh* sm = pMesh->CreateSubMesh();

        unsigned short streamID = 0;

        DiString material = ReadString(stream);
        sm->SetMaterialName(material);

        DI_SERIAL_LOG("Liking material: %s", material.c_str());

        unsigned int indexCount = 0;
        ReadInts(stream, &indexCount, 1);

        DI_SERIAL_LOG("Indeices count: %d", indexCount);

        bool idx32bit;
        ReadBools(stream, &idx32bit, 1);

        DI_SERIAL_LOG("Index size: %d", idx32bit?32:16);

        uint16 primitive;
        ReadShorts(stream,&primitive,1);
        sm->SetPrimitiveType((DiPrimitiveType)primitive);

        DI_SERIAL_LOG("Primitive type: %d", primitive);

        if (indexCount > 0)
        {
            void* indexdata = sm->CreateIndexData(indexCount,idx32bit?TRUE:FALSE);
            int size = indexCount * (sm->GetIndexSize() / 8);
            stream->Read(indexdata, size);
            DI_SERIAL_LOG("%d bytes readed", size);
        }

        streamID = ReadChunk(stream);
        if (streamID != DI_GEOMETRY)
        {
            DI_ERROR("Bad stream ID");
            return;
        }

        ReadGeometry(stream, sm);

        if (!stream->Eof())
        {
            streamID = ReadChunk(stream);
            if (streamID == DI_MESH_WEIGHTS)
            {
                ReadSubMeshBoneWeights(stream,sm);
            }
            else
            {
                if (!stream->Eof())
                    stream->Skip(-MSTREAM_OVERHEAD_SIZE);
            }
        }
    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:60,代码来源:MeshSerial.cpp


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