if (DirectDrawCreateEx(NULL, (void **)&m_lpDD, IID_IDirectDraw7, NULL) != DD_OK)
return E_FAIL;
if (m_lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE / DDSCL_FULLSCREEN) != DD_OK)
return E_FAIL;
if (m_lpDD->SetDisplayMode(640, 480, 8, 0, 0) != DD_OK)
return E_FAIL;
DDSURFACEDESC2 ddsd;
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS / DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE / DDSCAPS_FLIP / DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
HRESULT hResult = m_lpDD->CreateSurface(&ddsd, &m_lpDDSPrimary, NULL);
if (hResult != DD_OK)
return E_FAIL;
Any help would be appreciated...
Where's my Golden Fleece?DD primary surface creation error
I''ve been able to use DD before with no problem... But I''ve started a new project and for some reason my code to create the primary surface returns a DDERR_INVALIDCAPS result (on the m_lpDD->CreateSurface(...) call). But I don''t know why my surface caps would be wrong... here is the code:
February 18, 2000 09:32 AM
Try adding
memset( &ddscaps, 0, sizeof(ddscaps) );
right after
DDSURFACEDESC2 ddsd;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement