MCPcopy Create free account
hub / github.com/WinDurango/WinDurango / Initialize

Method Initialize

projects/WinDurango.Common/src/GUI.cpp:8–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6namespace 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 {

Callers 2

InitMethod · 0.45

Calls 3

GetBufferMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected