Original Post
Ive got an error when I lock my surface, I cant figure out why, the return code is DDERR_SURFACELOST, but where does it lose the surface!?? The pixels arent drawn eitha...
Edited by - ACAC on January 22, 2002 4:41:04 PM
int GameMain()
{
HRESULT hret;
if(KEYDOWN(VK_ESCAPE)) {
UnInit();
PostQuitMessage(0); }
CLEARMEM(ddsd);
hret = lpddsback->Lock(NULL, &ddsd, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, NULL); // this is possibly the offending line
if(hret != DD_OK)
{
ERR(hret);
return 1;
}
UCHAR *videomem = (UCHAR*)ddsd.lpSurface;
for(int x = 0; x < 500; x++)
{
for(int y = 0; y < 500; y++)
{
videomem[x + y * ddsd.lPitch] = _RGB(50,0,0);
}
}
hret = lpddsback->Unlock(NULL);
if(hret != DD_OK)
{
ERR(hret);
return 1;
}
hret = lpddsprimary->Flip(NULL,DDFLIP_WAIT);
if(hret != DD_OK)
{
ERR(hret);
return 1;
}
return 0;
}
|