Original Post
Hello everyone,
I'm having some trouble with my DDraw program when it come to my surface creation function. I have the code listed below. The problem is that the surface does not seem to be created. I am unable to blit the surface or load and image into it. Can anyone figure out what is going on? The surface passed to the function is stored as a global.
<< START CODE >>
// Create generic direct draw offscreen surface
bool SSCreateSurface(LPDIRECTDRAWSURFACE lpDDS, int width, int height)
{
DDSURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS / DDSD_HEIGHT / DDSD_WIDTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwHeight = height;
ddsd.dwWidth = width;
ddrval = lpDD->CreateSurface(&ddsd, &lpDDS, NULL);
if (ddrval != DD_OK)
{
OutputDebugString("Couldn't create offscreen surface in SSCreateSurface() - DXUtils.cpp\n");
MessageBox(hWnd,"Couldn't create offscreen surface.","ERROR",MB_OK/MB_ICONSTOP);
return NULL;
}
return TRUE;
}
<< END CODE >>
As well I was wondering whether it is necessary to lock a surface when blitting another surface to it, or if locking is only necessary when directly manipulating the surface pixels.
Thanks for any help,
Derek
Edited by - Reaptide on 4/28/00 1:31:35 PM