Full Screen DirectDraw ProgramsFull screen DirectDraw programs require additional setup and other tasks not normally found in windowed programs. This includes using a different window style, establishing the DirectDraw display mode, and possibly adding new message or event handlers. We'll first show how to set up a suitable window style for full screen programs. For C/C++ windowed applications (DirectDraw or otherwise), we use the Windows API function CreateWindow() specifying a window style of WS_OVERLAPPEDWINDOW. For full screen programs, we must instead create a borderless window that will always be the topmost window. To do this, use CreateWindowEx() specifying WS_EX_TOPMOST as the extended window style and WS_POPUP as the window style, as shown here:
For C++Builder and Delphi, you must change the values of certain properties through the Object Inspector for full screen programs, as shown here:
For Visual Basic, we recommend setting the BorderStyle form property to 0 (none). This is not required but provides a smoother transition when your program first switches to the full screen mode. You must use the default 0 (normal) setting for the WindowState form property, or the program may not exit properly. To use DirectDraw full screen modes with Fastgraph, you must call fg_ddsetup() in the WM_CREATE handler before calling any other Fastgraph function. The first two fg_ddsetup() parameters define the horizontal and vertical resolution of the full screen display mode; they can be any valid screen resolution DirectDraw supports. The third parameter defines the screen's color depth in bits per pixel and must be 8, 16, 24, or 32. The fourth parameter specifies the type of DirectDraw primary surface to create. Set it to FG_DX_BLIT if the program uses DirectX blitting, or set it to FG_DX_FLIP for DirectX page flipping. For example, to initialize DirectDraw for a 640x480 256-color display mode configured for DirectX blitting, use:
C/C++ and Delphi:
Visual Basic:
Note that fg_ddsetup() does not actually set the requested display mode. It merely defines the values so fg_vbinit() can initialize DirectDraw for the specified display mode and surface configuration. Do not call fg_ddsetup() if you're creating a windowed DirectDraw application. Most DirectX implementations will support both 24-bit and 32-bit true color display modes, but some will support only one or the other. For full screen DirectX programs that use a true color display mode, fg_vbinit() will first try to initialize DirectDraw for the requested true color bit depth. If that fails, it will then try using the alternate true color bit depth. If you don't want this behavior, specify FG_DX_TCDEPTH in addition to the FG_DX_BLIT or FG_DX_FLIP flag when calling fg_ddsetup(). FG_DX_TCDEPTH causes fg_vbinit() to try only the requested true color bit depth when initializing DirectDraw (this is the Fastgraph 5.0 behavior).
|
 
copyright 2001 Ted Gruber Software, Inc.