Witam mam pytanko - w jaki sposób miałbym zmodyfikować tak aby po przyłączeniu dllki do ekranu d3d ekran nie migał wtedy kiedy renderuje się tekst.
Tutaj zamieszczam kodzik
#include <windows.h>
#include <process.h>
#include <string>
#include <d3d9.h>
#include <d3dx9.h>
#include <time.h>
IDirect3D9 *pD3D = 0;
IDirect3DDevice9 *pD3DDevice = 0;
ID3DXFont *pD3DFont = 0;
HRESULT hr;
HWND hWnd;
void __cdecl MainTheard(void * Args);
int initD3D(HWND hWnd);
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
if(fdwReason==DLL_PROCESS_ATTACH)
{
_beginthread( MainTheard, 0, NULL );
// MessageBox(0,TEXT("Cheat zainjectowany!"),TEXT("Done"),0);
}
return TRUE;
}
void __cdecl MainTheard(void * Args){
hWnd = FindWindow(NULL, TEXT("Test D3D9 window"));
if(!hWnd){MessageBox(0,TEXT("pOSZLo"),TEXT("Done"),0);}
initD3D(hWnd);
hr=D3DXCreateFont(pD3DDevice, //D3D Device
30, //Wielkość czcionki
0, //Szerokość czcionki
FW_NORMAL,
1,
false,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY, //Jakość czcionki
DEFAULT_PITCH|FF_DONTCARE,
L"Arial", //Nazwa czcionki
&pD3DFont); // zdefiniowana "nowa" czcionka
D3DCOLOR fontColor = D3DCOLOR_ARGB(255,0,0,255); // Kolor tekstu
RECT rct;
rct.top = 9;
rct.left = 30;
rct.bottom = 110;
rct.right = 400;
pD3DDevice->BeginScene();
for(;;){
//pD3DDevice->BeginScene();
//pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 1.0f, 0);
pD3DFont->DrawTextA(NULL, "Blabla test", -1, &rct, 0, fontColor);
//pD3DFont->Release();
pD3DDevice->EndScene();
pD3DDevice->Present(NULL, NULL, NULL, NULL);
//}
}
}
int initD3D(HWND hwnd)
{
pD3D = Direct3DCreate9(D3D_SDK_VERSION);
if (pD3D == NULL)
{
MessageBox(hwnd, TEXT("An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again."), TEXT("Error"), MB_OK);
return 0;
}
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pD3DDevice);
if (pD3DDevice == NULL)
{
MessageBox(hwnd, TEXT("An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again."), TEXT("Error"), MB_OK);
return 0;
}
srand(time(NULL));
return 1;
}