Hybrid Programs

It's also possible to create DirectDraw programs that switch between windowed and full screen modes. To switch modes, you must first shut down Fastgraph's virtual buffer environment with fg_vbclose(), fg_vbfree(), and fg_vbfin(), just as you normally do in the program's WM_DESTROY handler. If your program is running in DirectDraw windowed mode and you want to switch to a full screen mode, you then call fg_ddsetup() to define the screen resolution, color depth, and primary surface configuration. If you instead want to switch from a full screen mode to windowed mode, call fg_ddsetup() with the color depth parameter set to zero (in this case, fg_ddsetup() ignores the other parameters). Finally, you must re-initialize Fastgraph's virtual buffer environment with fg_vbinit(), and re-create any virtual buffers with fg_vballoc(). In either case, you must also change the window style as described in the previous two sections to reflect the new mode. As with ordinary DirectDraw windowed programs, programs that switch from full screen to windowed mode must use the same virtual buffer color depth as the Windows display driver when running in windowed mode.

Note that the mode switch process involves shutting down and then re-initializing Fastgraph's virtual buffer environment. This of course means the contents of all virtual buffers will be lost. If you need to preserve the virtual buffer contents across DirectDraw mode switches, you can first save each virtual buffer with fg_getimage() or fg_getdcb(), and then restore the contents with fg_putimage() or fg_putdcb() after re-creating the virtual buffers.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.