home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / tegl_ii / intro / grtest02.pas < prev    next >
Pascal/Delphi Source File  |  1991-04-07  |  4KB  |  119 lines

  1. {-----------------------------------------------------------------------------}
  2. {               TEGL Windows ToolKit II                  }
  3. {          Copyright (C) 1990, TEGL Systems Corporation              }
  4. {                All Rights Reserved.                  }
  5. {-----------------------------------------------------------------------------}
  6. {                                          }
  7. { TEGL's Graphic Interface has a different driver arrangement than that of    }
  8. { Borland's BGI. Refer to the readme file for a one-to-one correspondence     }
  9. { of driver modes and driver names to Borland's modes and names.              }
  10. {                                          }
  11. { This program demonstrates the linking of the TGI driver with the program    }
  12. { code for a complete standalone graphic program. If you wish to try the      }
  13. { the identical code with Borland's BGI, you can remove the comment brackets  }
  14. { corresponding to the BGI driver and comment out the TGI code.           }
  15. {                                          }
  16. { Remeber to change tgraph to graph, otherwise you will get an invalid driver }
  17. { mode error when you attempt to link a BGI driver with TEGL.              }
  18. {                                          }
  19. { You should see a major difference in size and speed. TEGL's TGI is about    }
  20. { 1/3 smaller than Borland's BGI and 2-6 times faster.                        }
  21. {                                          }
  22. { To create the 'grevga16.obj' or 'egavga.obj' file, use the TGBINOBJ.EXE     }
  23. { program in your TEGL utility directory to convert the 'grevga16.tgi' or     }
  24. { 'egavga.bgi' respectively.                                                  }
  25. {                                          }
  26. {  C>tgbinobj grevga16.tgi                              }
  27. {                                          }
  28. {  C>tgbinobj egavga.bgi                              }
  29. {                                          }
  30. {-----------------------------------------------------------------------------}
  31. { $define BGI}
  32.  
  33. uses
  34.    crt,
  35. {$ifdef BGI}
  36.    graph;
  37. {$else}
  38.    tgraph;
  39. {$endif}
  40.  
  41. {$F+}
  42.  
  43. {$ifdef BGI}
  44. Procedure egavga; External;
  45. {$L egavga.obj}
  46. {$else}
  47. Procedure grevga16; External;
  48. {$L grevga16.obj}
  49. {$endif}
  50.  
  51. var gd,gm,i  : integer;
  52.     ch         : char;
  53.     driver   : pointer;
  54.     modenames: array[0..10] of string;
  55.     activegm : string;
  56.     oldgd    : integer;
  57.     maxmode  : integer;
  58.  
  59. begin
  60.  
  61. {$ifdef BGI}
  62.    driver := @egavga;
  63. {$else}
  64.    driver := @grevga16;
  65. {$endif}
  66.  
  67.  
  68. {According to the manuals, registerbgidriver() should return the internal
  69.  driver number. In the case of 'egavga' the internal graphic driver should
  70.  have been 5 for EGA and 9 for VGA, however a quick display of the returned
  71.  gd shows that the return value is 1.
  72.  
  73.  The TEGL drivers may be registered using the registerbgidriver(). 'gd'
  74.  will always return a driver value of 11 and greater. You can use the
  75.  original default values as provided by TGRAPH where gd := EGA, or
  76.  use the new assigned graphic driver number. With the new graphic driver
  77.  number, you can use the new extended modes provided the driver.
  78.  
  79.  Example. GREVGA16 provides up to 6 different video modes that you can
  80.  try on your system. This includes the SVGA 800x600 mode number 2.
  81.  }
  82.  
  83.  
  84.    gd := registerbgidriver(driver);
  85.    if gd<0 then
  86.       begin
  87.      writeln('Error registering driver:',GraphErrorMsg(GraphResult));
  88.      halt(1);
  89.       end;
  90.  
  91. {$ifdef BGI}
  92.    oldgd := gd;
  93.    gd := vga;
  94.    gm := vgahi;
  95. {$else}
  96.    gm := 5;
  97. {$endif}
  98.    initgraph(gd,gm,'');
  99.  
  100.    setcolor(blue);
  101.    rectangle(0,0,getmaxx,getmaxy);
  102.  
  103.    while keypressed do ch:=readkey;
  104.    while not keypressed do;
  105.    while keypressed do ch:=readkey;
  106.  
  107.    activegm := getmodename(gm);
  108.    maxmode  := getmaxmode;
  109.    for i:=0 to maxmode do
  110.       modenames[i] := Getmodename(i);
  111.  
  112.    closegraph;
  113.  
  114.    writeln('Graphic Driver Name : ',GetDriverName,'  Driver Number [',gd,'] Old GD [',oldgd,']');
  115.    writeln('Active Mode Name    : ',activegm,'   Mode Number [',gm,']');
  116.    for i:=0 to maxmode do
  117.       writeln('Mode ',i,' Name   : ',modenames[i]);
  118. end.
  119.