Windowed DirectDraw Programs

Windowed DirectDraw programs are very similar to windowed programs created with Fastgraph's native libraries. The major difference is that virtual buffers in windowed DirectDraw programs must use the same color depth as the Windows display driver. In native programs, using the same color depth will provide the best performance, but you can still, for example, blit a 256-color virtual buffer to a high color display. That's not the case for windowed DirectDraw programs, so we must call fg_colors() to get the display driver color depth and make sure all virtual buffers use that color depth.

DirectDraw programs also require a minor change to the WM_CREATE event handler. This is because the creation of DirectDraw's primary surface occurs in fg_vbinit(), and this must take place after the window is first displayed. Hence, we must explicitly make the window visible inside WM_CREATE as shown here:




Visible = True;


Visible := True;

Visual Basic:

Visible = True

We recommend doing this after the call to fg_realize(), but before the call to fg_vbinit(). Making the window visible in WM_CREATE can also be done in native programs, so you don't need to provide a special conditional compilation sequence for DirectDraw programs.

Visual Basic DirectDraw programs must use the default 0 (normal) setting for the WindowState form property, or the program may not exit properly.

<< Prev

Next >>

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.