|
|
|
@ -5,6 +5,7 @@ |
|
|
|
|
#include <d3dx9.h> |
|
|
|
|
#define DIRECTINPUT_VERSION 0x0800 |
|
|
|
|
#include <dinput.h> |
|
|
|
|
#include <tchar.h> |
|
|
|
|
|
|
|
|
|
// Data
|
|
|
|
|
static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; |
|
|
|
@ -44,15 +45,15 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) |
|
|
|
|
int main(int, char**) |
|
|
|
|
{ |
|
|
|
|
// Create application window
|
|
|
|
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, LoadCursor(NULL, IDC_ARROW), NULL, NULL, L"ImGui Example", NULL }; |
|
|
|
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, LoadCursor(NULL, IDC_ARROW), NULL, NULL, _T("ImGui Example"), NULL }; |
|
|
|
|
RegisterClassEx(&wc); |
|
|
|
|
HWND hwnd = CreateWindow(L"ImGui Example", L"ImGui DirectX9 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL); |
|
|
|
|
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL); |
|
|
|
|
|
|
|
|
|
// Initialize Direct3D
|
|
|
|
|
LPDIRECT3D9 pD3D; |
|
|
|
|
if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL) |
|
|
|
|
{ |
|
|
|
|
UnregisterClass(L"ImGui Example", wc.hInstance); |
|
|
|
|
UnregisterClass(_T("ImGui Example"), wc.hInstance); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp)); |
|
|
|
@ -67,7 +68,7 @@ int main(int, char**) |
|
|
|
|
if (pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0) |
|
|
|
|
{ |
|
|
|
|
pD3D->Release(); |
|
|
|
|
UnregisterClass(L"ImGui Example", wc.hInstance); |
|
|
|
|
UnregisterClass(_T("ImGui Example"), wc.hInstance); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -154,7 +155,7 @@ int main(int, char**) |
|
|
|
|
ImGui_ImplDX9_Shutdown(); |
|
|
|
|
if (g_pd3dDevice) g_pd3dDevice->Release(); |
|
|
|
|
if (pD3D) pD3D->Release(); |
|
|
|
|
UnregisterClass(L"ImGui Example", wc.hInstance); |
|
|
|
|
UnregisterClass(_T("ImGui Example"), wc.hInstance); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|