benkimim32
Gold Üye
- Katılım
- 25 Tem 2024
- Mesajlar
- 233
- Beğeniler
- 19
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
LPDIRECT3D9 pD3D9 = NULL;
LPDIRECT3DDEVICE9 pDevice = NULL;
bool InitD3D(HWND hWnd) {
pD3D9 = Direct3DCreate9(D3D_SDK_VERSION);
if (!pD3D9) return false;
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferWidth = 800;
d3dpp.BackBufferHeight = 600;
pD3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice);
if (!pDevice) return false;
return true;
}
void CleanD3D() {
if (pDevice) pDevice->Release();
if (pD3D9) pD3D9->Release();
}
bool Draw() {
pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
pDevice->BeginScene();
pDevice->EndScene();
pDevice->Present(NULL, NULL, NULL, NULL);
return true;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
InitD3D(NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
CleanD3D();
break;
}
return TRUE; işinize yararmı
}
işinize yararsa yazarmısınız
#include <d3d9.h>
#include <d3dx9.h>
LPDIRECT3D9 pD3D9 = NULL;
LPDIRECT3DDEVICE9 pDevice = NULL;
bool InitD3D(HWND hWnd) {
pD3D9 = Direct3DCreate9(D3D_SDK_VERSION);
if (!pD3D9) return false;
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferWidth = 800;
d3dpp.BackBufferHeight = 600;
pD3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice);
if (!pDevice) return false;
return true;
}
void CleanD3D() {
if (pDevice) pDevice->Release();
if (pD3D9) pD3D9->Release();
}
bool Draw() {
pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
pDevice->BeginScene();
pDevice->EndScene();
pDevice->Present(NULL, NULL, NULL, NULL);
return true;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
InitD3D(NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
CleanD3D();
break;
}
return TRUE; işinize yararmı
}
işinize yararsa yazarmısınız