Other Considerations

While the fish tank DOS to Windows conversion illustrated the most common problems you'll encounter when porting programs to Windows, they're certainly not all-encompassing. For example, a DOS program that uses Fastgraph's low-level keyboard handler will include calls to fg_kbinit() and fg_kbtest(). Because the keyboard handler is always enabled in Fastgraph for Windows programs, Fastgraph for Windows does not include the fg_kbinit() function. In this case, the solution is simple: just remove the call to fg_kbinit(). In other cases, your program might call other Fastgraph for DOS functions that aren't available in the Windows version.

If you're porting a program that includes calls to fg_setcolor(), you'll probably need to make some changes to the color values. Unless you've changed colors 0 and 255 in the DOS program, fg_setcolor(0) and fg_setcolor(255) calls can be left as is because these colors are also black and white in Windows. If the program uses only the first 16 DOS colors, you can add 10 to all values passed to fg_setcolor(), assuming you'll use the default logical palette in the Windows program. Another possibility is to use fg_maprgb() to locate the color in terms of its RGB color components, and then use the fg_maprgb() return value when you want to specify that color in fg_setcolor() calls.

Fastgraph for DOS includes the fg_resize() function for resizing video memory. It is typically used with another function, fg_pan(), to perform smooth hardware panning. Because Windows does not support hardware panning, Fastgraph for Windows does not include either of these functions. Still, it's not terribly difficult to port DOS programs that resize video memory to Windows. A good example of this is the QuickFire program. Its original DOS version resized video memory (in mode 20) to one large 352x727 page and simulated page flipping by panning between two distinct 320x200 subsets of this page. In the Windows version, we created a 352x727 virtual buffer and used fg_vbscale() to blit the same 320x200 regions to the client area.

<< Prev

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.