| 6 | namespace wd::common |
| 7 | { |
| 8 | void GUI::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, IDXGISwapChain1* pSwapchain) |
| 9 | { |
| 10 | m_pDevice = pDevice; |
| 11 | m_pContext = pContext; |
| 12 | m_pSwapchain = pSwapchain; |
| 13 | ID3D11Texture2D* pBackBuffer = nullptr; |
| 14 | m_pSwapchain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); |
| 15 | m_pDevice->CreateRenderTargetView(pBackBuffer, nullptr, &m_pRenderTargetView); |
| 16 | if (pBackBuffer) pBackBuffer->Release(); |
| 17 | |
| 18 | ImGui::CreateContext(); |
| 19 | |
| 20 | ImGuiIO& io = ImGui::GetIO(); (void)io; |
| 21 | io.IniFilename = "imgui.ini"; |
| 22 | io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; |
| 23 | io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; |
| 24 | |
| 25 | ImFont* mainFont = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/Bahnschrift.ttf", 18.0f); |
| 26 | |
| 27 | ImFontConfig config; |
| 28 | config.MergeMode = true; |
| 29 | config.GlyphOffset.y = 4.0f; |
| 30 | |
| 31 | static const ImWchar icon_ranges[] = { 0xE7FC, 0xF11B, 0 }; |
| 32 | static const ImWchar icon_ranges2[] = { 0xE782, 0xE782, 0 }; |
| 33 | static const ImWchar icon_ranges3[] = { 0xE2AF, 0xE2AF, 0 }; |
| 34 | io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\segmdl2.ttf", 18.0f, &config, icon_ranges); |
| 35 | io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\segmdl2.ttf", 30.0f, &config, icon_ranges3); |
| 36 | io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\segmdl2.ttf", 30.0f, &config, icon_ranges2); |
| 37 | |
| 38 | ImGui_ImplUwp_InitForCurrentView(); |
| 39 | ImGui_ImplDX11_Init(m_pDevice, m_pContext); |
| 40 | } |
| 41 | |
| 42 | void GUI::Render() |
| 43 | { |
no test coverage detected