Archived

This topic is now archived and is closed to further replies.

Why does this lock up?

This topic is 6585 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hmmmm. Well it looks good. It could be the bitmap file itself. If you are trying to use a non-palletized bitmap then ddloadpallete would return 0, or worse. Make sure the bitmap is an 8-bit bitmap, that's all I could figure.

Share this post


Link to post
Share on other sites
heheh.

no, it wasn't the icons (which I uploaded early last week, I think). For reasons that I've not yet been able to determine, the server was down almost constantly from sometime late Saturday night until this morning. It seems fine now, so hopefully it will stay that way.

- Dave

Share this post


Link to post
Share on other sites

I'll try to keep it to a minimum; I was having problems getting the bitmap to load, and found that the DDLoadPalette was returning (0). I commented that part out of the code but now I can't get out of the program once the bitmap loads. Escape & F12 do nothing. Any help?
=============================================
int GameInit( HINSTANCE hInstance, int nCmdShow)

// I created the window here & then...
// created DD object & stuff (800,600,8)

// Creating a primary surface with one back buffer
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;

if(FAILED(lpdd->CreateSurface(&ddsd, &lpddsprimary, NULL)))
{
return(0);
}

// Get the pointer to the back buffer
ZeroMemory(&ddscaps, sizeof(ddscaps));
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
if(FAILED(lpddsprimary->GetAttachedSurface(&ddscaps, &lpddsback)))
{
return(0);
}

// Create an offscreen surface for bitmap
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwHeight = 600;
ddsd.dwWidth = 800;
if(FAILED(lpdd->CreateSurface(&ddsd, &lpddsoff1, NULL)))
{
return(0);
}

/* if(FAILED(lpddpal = DDLoadPalette(lpdd, szBitmap)))
{
return(0);
}*/

/* if(FAILED(lpddsprimary->SetPalette(lpddpal)))
{
return(0);
}*/

if(FAILED(InitSurfaces()))
{
return(0);
}

if(TIMER_ID != SetTimer(hwnd, TIMER_ID, TIMER_RATE, NULL))
{
return (0);
}

return(1);

}
//-----------------------------------------

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;

GameInit(hInstance, nCmdShow);

while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return msg.wParam;
}
=============================================
I left out what I didn't think was important, but if you need to see WindowProc or whatever I can post it too.

------------------
Still Learning...

Share this post


Link to post
Share on other sites