Archived

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

Prime

Where, oh where, has my bitmap gone?

Recommended Posts

Hi, I'm running through the Game Programming Genesis DirectDraw tutorials and I'm having trouble getting a bitmap onto the screen. Looking over my code, as far as I can tell it should work, but my bitmap does not appear on the screen. Everything else seems to run okay and I don't get any error messages, so I think that maybe the bitmap is getting loaded okay. I would be greatful if someone could have a peak at my code and maybe point out where my problem might be (and any other pointers would be great as well). Thanks for any help! Cheers, Prime Here's a snippit: (sorry for the length) in main.cpp -- snipped -- bool gameWork() { // lock the primary surface (for now) // later we will use the back buffer as well INIT_DXSTRUCT(ddSurfaceStruct); // clean our struct if(FAILED(ddPrimarySurfacePtr->Lock(NULL, &ddSurfaceStruct, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, NULL))) { return false; } // set up our some pixels USHORT *displayBuffer = (USHORT*)ddSurfaceStruct.lpSurface; // get the buffer of display memory int pitch = (ddSurfaceStruct.lPitch>>1); // divide by 2 to get number of USHORTs (for 16bit) USHORT colour; // for our color // check color depth if (pixelFormat == 555) colour = RGB_16BIT555(31, 31, 31); else colour = RGB_16BIT565(31, 31, 31); //plot some pixels plotPixel16(200, 200, colour, displayBuffer, pitch); plotPixel16(370, 370, colour, displayBuffer, pitch); // clear back buffer //clearBuffer(ddPrimarySurfacePtr); // bitmap stuff //setSurfaceColourKey(ddBackBufferPtr, 255, 0, 0); // set to red // set the location of the bitmap //SetRect(&location, 200, 200, 32, 32); // copy the image to the back buffer //ddBackBufferPtr->Blt(&location, myBitmap, NULL, DDBLT_WAIT, NULL); // now blit the back buffer to the primary surface //ddPrimarySurfacePtr->Blt(NULL, ddBackBufferPtr, NULL, DDBLT_WAIT, NULL); //(I realize that I don't really want to dump the bitmap directly //to the primary screen buffer and scale to the full size, but I //was just trying to eliminate as many variables as possibles) ddPrimarySurfacePtr->Blt(NULL, myBitmap, NULL, DDBLT_WAIT, NULL); // unlock surface ddPrimarySurfacePtr->Unlock(NULL); return true; } -- snipped -- Edited by - Prime on June 12, 2001 10:09:24 AM

Share this post


Link to post
Share on other sites
No offence, but don''t post huge amounts of code and expect people to wade through and find one little problem. Do a little research and narrow the problem down to a single function or, even better, a few lines.


War Worlds - A 3D Real-Time Strategy game in development.

Share this post


Link to post
Share on other sites
Hi,

Yeah, your right, I was kind of thinking that after I had done it. I've cleaned it up that post a bit. And I think I have found my problem

Prime

Edited by - Prime on June 12, 2001 12:03:19 PM

Share this post


Link to post
Share on other sites