Advertisement

Why does this lock up?

Started by December 06, 1999 06:23 PM
5 comments, last by frizb 25 years 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.
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


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