- Splat
I need help with bitmaps & directdraw

Second, if you have the DirectX SDK installed, a sample file I believe called "ddutil.cpp" (never used it) contains a function DDReLoadBitmap() which handles taking a bitmap file and dumping the information correctly into a DirectDraw surface. You could either use that function or read it and learn how to do it yourself.
- Splat
1. Create a surface for the bitmap.
2. Load the bitmap into the surface.
3. Blit the bitmap onto the back buffer.
4. Flip the back buffer to the primary surface. (you can do this, right?)
1. and 2.
Luckily, Microsoft made a function that creates an offscreen surface and loads a bitmap into it: DDLoadBitmap(). To use this, though, you need to get the files "ddutil.cpp" and "ddutil.h" from the DirectDraw SDK. If you don't have them and want em, I can send them to you.
Now, after you've included the ddutil.h file, call DDLoadBitmap() like this:
LPDIRECTDRAWSURFACE4 lpDDSBitmap = NULL;
if ( ( lpDDSBitmap = DDLoadBitmap( lpDD, "bitmap.bmp", 0, 0) ) == NULL )
return FALSE;
Now the bitmap is loaded into lpDDSBitmap!
3.
To blit the bitmap onto the back buffer, call BltFast():
RECT rcFrom;
rcFrom.left = 0;
rcFrom.top = 0;
rcFrom.right = BITMAP_WIDTH;
rcFrom.bottom = BITMAP_HEIGHT;
if ( FAILED( lpDDSBack->BltFast( 0, 0, lpDDSBitmap, &rcFrom, DDBLTFAST_WAIT ) ) )
return FALSE;
What the DDLoadBitmap() function does is creates a HBITMAP and a DirectDraw sufrace, uses a Windows function (LoadImage()) to load the bitmap from a resource or a file into the HBITMAP, then blits the bitmap from the HBITMAP to the DirectDraw Surface using another Windows function (StretchBlt()).
If you need any more help, send me and email or post to this thread.
I would suggest that you look over the function really well before you use it so you know what it's doing...
------------------
- mallen22@concentric.net
- http://members.tripod.com/mxf_entertainment/
[This message has been edited by Matthew Allen (edited November 04, 1999).]

Thanks, AcidJazz
P.S. If you wouldn't mind helping me a little one on one, just add me to your icq list, my uin is 16357086. If you have aim, my sn is AcidJazz13 Thanks again
As another poster said, if you want to load bmp files, there is a function which does it for you, so you can just live in ignorant bliss =)
You can think of a DC ( a device context) as just that, the state of a particular device, like the screen you are reading this off of, or a printer.
A HBITMAP is basically a handle to a bitmap, be it a blank memory buffer, or if you get it from a DC, a copy of that contexts "output" or display.