Est-on obligé d'utiliser le back buffer avec ddraw ?
Voici mon code, il compile mais ne marche pas -> Message d'erreur Windows
LPDIRECTDRAW dd;
DDSURFACEDESC ddsd;
LPDIRECTDRAWSURFACE lpDDSPrimary;
HDC hdc;
HWND hwnd;
char szFrontMsg[] = "Front Message";
DirectDrawCreate(NULL,&dd,NULL);
dd->SetCooperativeLevel(hwnd,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
dd->SetDisplayMode(640,480,8);
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
dd->CreateSurface(&ddsd,&lpDDSPrimary,NULL);
if (lpDDSPrimary->GetDC(&hdc) == DD_OK) //***ICI que ça plante***
{
SetBkColor(hdc,RGB(0,0,255));
SetTextColor(hdc,RGB(255,255,0));
TextOut(hdc,0,0,szFrontMsg,lstrlen(szFrontMsg));
lpDDSPrimary->ReleaseDC(hdc);
}
Sleep(5000);
if(dd != NULL)
{
if(lpDDSPrimary != NULL)
{
lpDDSPrimary->Release();
lpDDSPrimary = NULL;
}
dd->Release();
dd = NULL;
}