🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Why does this lock up?

Started by
5 comments, last by frizb 24 years, 6 months ago
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.
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
Advertisement
Are you checking for a ESC or F12 keypress and then terminating the program? Silly question, but then again, you never know.
William Reiach - Human Extrodinaire

Marlene and Me


Thanks, I got it to work now. Coudln't connect to this sight for the last couple days.

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

Still Learning...
Hehe, I love those new icons!

But now to the point:
I havn't been able to connect to this site for a couple of days (until now) either. What was wrong?

Ok, I know I shouldn't respond like this in a serius forum like this, but...

Uploading icons?(!)


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...

Still Learning...
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

This topic is closed to new replies.

Advertisement