Platform SDK: DirectX

Tutorial 2: Loading Bitmaps on the Back Buffer

[Visual Basic]

The information in this section pertains only to applications written in C and C++. See DirectDraw Visual Basic Tutorials.

[C++]

The sample discussed in this tutorial (DDEx2) expands on the DDEx1 sample that was discussed in Tutorial 1. DDEx2 includes functionality to load a bitmap file on the back buffer. This new functionality is demonstrated in the following steps.

As in DDEx1, doInit is the initialization function for the DDEx2 application. Although the code for the DirectDraw initialization does not look quite the same in DDEx2 as it did in DDEx1, it is essentially the same, except for the following section.

lpDDPal = DDLoadPalette(lpDD, szBackground); 
 
if (lpDDPal == NULL) 
    goto error; 
 
ddrval = lpDDSPrimary->SetPalette(lpDDPal); 
 
if(ddrval != DD_OK) 
    goto error; 
 
// Load a bitmap into the back buffer. 
ddrval = DDReLoadBitmap(lpDDSBack, szBackground); 
 
if(ddrval != DD_OK) 
    goto error;