MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / DirectXInit

Method DirectXInit

KBotExt/DirectX.cpp:13–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "SettingsTab.h"
12
13bool Direct3D11Render::DirectXInit(const HWND hWnd)
14{
15 // Setup swap chain
16 DXGI_SWAP_CHAIN_DESC sd;
17 ZeroMemory(&sd, sizeof(sd));
18 sd.BufferCount = 2;
19 sd.BufferDesc.Width = 0;
20 sd.BufferDesc.Height = 0;
21 sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
22 sd.BufferDesc.RefreshRate.Numerator = 60;
23 sd.BufferDesc.RefreshRate.Denominator = 1;
24 sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
25 sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
26 sd.OutputWindow = hWnd;
27 sd.SampleDesc.Count = 1;
28 sd.SampleDesc.Quality = 0;
29 sd.Windowed = TRUE;
30 sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
31
32 //createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
33 D3D_FEATURE_LEVEL featureLevel;
34 constexpr D3D_FEATURE_LEVEL featureLevelArray[2] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0, };
35 if (constexpr UINT createDeviceFlags = 0; D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, createDeviceFlags,
36 featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain,
37 &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext) != S_OK)
38 return false;
39
40 if (!CreateRenderTarget())
41 return false;
42
43 Renderimgui(hWnd);
44
45 Misc::CheckVersion();
46
47 if (S.checkPrerelease)
48 Misc::CheckPrerelease(S.fileName);
49
50 gamePatch = Misc::GetCurrentPatch();
51
52 std::thread t{ Misc::GetAllChampionSkins };
53 t.detach();
54
55 std::thread AutoAcceptThread(&GameTab::AutoAccept);
56 AutoAcceptThread.detach();
57
58 return true;
59}
60
61void Direct3D11Render::StartFrame()
62{

Callers 1

wWinMainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected