DirectX SDK |
This section pertains only to application development in Visual Basic. See DirectDraw C/C++ Tutorials.
Initializing the off-screen surface buffers for the background image and the sprite image is essentially identical to the Step 2: Initialize the Surfaces topic found in Tutorial 2. The only difference is that we create the background surface with the surface description of the back buffer. This is easily obtained by calling the DirectDrawSurface7.GetSurfaceDesc method. This is shown in the statements:
backbuffer.GetSurfaceDesc ddsd4 ddsd2.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH ddsd2.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN ddsd2.lWidth = ddsd4.lWidth ddsd2.lHeight = ddsd4.lHeight Set lakesurf = dd.CreateSurfaceFromFile("lake.bmp", ddsd2)