Platform SDK: DirectX |
The information in this section pertains only to applications written in C and C++. See DirectDraw Visual Basic Tutorials.
After the two off-screen surfaces are created, DDEx3 uses the InitSurfaces sample function to load the bitmaps from the Frntback.bmp file onto the surfaces. The InitSurfaces function uses the DDCopyBitmap sample function located in Ddutil.cpp to load both of the bitmaps, as shown in the following example.
// Load the bitmap resource. hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); if (hbm == NULL) return FALSE; DDCopyBitmap(lpDDSOne, hbm, 0, 0, 640, 480); DDCopyBitmap(lpDDSTwo, hbm, 0, 480, 640, 480); DeleteObject(hbm); return TRUE;
If you look at the Frntback.bmp file in Microsoft® Paint or another drawing application, you can see that the bitmap consists of two screens, one on top of the other. The DDCopyBitmap function breaks the bitmap in two at the point where the screens meet. In addition, it loads the first bitmap into the first off-screen surface (lpDDSOne) and the second bitmap into the second off-screen surface (lpDDSTwo).
Next: Step 3: Blit the Off-Screen Surfaces to the Back Buffer