Dear ImGUI 使用指南


文檔

1) Dear IMGui 

2) 知乎

組件

 1) Com 如何設置動態字符串?

//char*pTest = "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0";  用0 隔開所有的字符串。

        const int iLength = 1024;
        char szTemp[iLength] = {0};
        //SafeMBSprintf(szTemp,iLength,"%s",pMainUserContainer->GetUser()->GetName().c_str());
        int iIndex = 0;
        int iLefeTempBuffSize = iLength;
        char *pTemPointer = szTemp;
        auto iSize = vecOppentName.size();
        for (int i = 0 ; i < iSize; i++)
        {
            pTemPointer = szTemp + iIndex;
            auto iSize = vecOppentName[i].size();
            SafeMemcpy(pTemPointer,iLefeTempBuffSize,vecOppentName[i].c_str(),iSize);
            iIndex += iSize;
            szTemp[iIndex] = 0;
            //This space is set to 0 for spilt
            iIndex ++;
            iLefeTempBuffSize = iLength - iIndex;

        }
        pTemPointer[iIndex++] = 0;
        pTemPointer[iIndex] = 0

ImGui::Combo(szPosition, &iShowGuardSelectIndex[j], szTemp);

 

字體

1) 設置默認字體

                ImGui::CreateContext();

                    ImGuiIO& io = ImGui::GetIO();
                    io.Fonts->AddFontDefault();
                    ImFont* font = io.Fonts->AddFontFromFileTTF("font\\FounderCN.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesChineseFull());
                    IM_ASSERT(font != NULL);
                    ImGui::GetIO().FontDefault = font;
                    ImGui_ImplDX11_Init(device,context);
                    ImGui_ImplWin32_Init(window->WndHandle());
                    ImGui_ImplDX11_CreateDeviceObjects()

2)輸入中文必須采用utf8

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM