forked from taxi2za/Aeternum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.cpp
66 lines (59 loc) · 1.35 KB
/
Game.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "Game.hpp"
//# DO NOT C&P IF U DUNNO HOW TO USE IT
//> he4rtbleed - https://github.com/he4rtbleed/Aeternum
namespace Aeternum
{
IDXGISwapChain* GetSwapChain(HWND hWnd)
{
HMODULE hDXGIDLL = 0;
do
{
auto dxgiStr = skCrypt("dxgi.dll");
hDXGIDLL = GetModuleHandle(dxgiStr);
dxgiStr.clear();
Sleep(1);
} while (!hDXGIDLL);
DXGI_SWAP_CHAIN_DESC swapDesc;
ZeroMemory(&swapDesc, sizeof(swapDesc));
swapDesc.BufferCount = 1;
swapDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapDesc.OutputWindow = hWnd;
swapDesc.SampleDesc.Count = 1;
swapDesc.Windowed = TRUE;
D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0;
IDXGISwapChain* pSwapChain = 0;
ID3D11Device* pDevice = NULL;
ID3D11DeviceContext* pContext = NULL;
if (SUCCEEDED(D3D11CreateDeviceAndSwapChain(
NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
NULL,
&featureLevel,
1,
D3D11_SDK_VERSION,
&swapDesc,
&pSwapChain,
&pDevice,
NULL,
&pContext)))
{
pContext->Release();
pDevice->Release();
return pSwapChain;
}
else
return NULL;
}
GameVariables::GameVariables()
{
auto wndStr = skCrypt("TankWindowClass");
m_GameWindow = FindWindowA(wndStr, NULL);
wndStr.clear();
m_Swapchain = GetSwapChain(m_GameWindow);
}
GameFunctions::GameFunctions()
{
}
}