home *** CD-ROM | disk | FTP | other *** search
- {-----------------------------------------------------------------------------}
- { TEGL Windows ToolKit II }
- { Copyright (C) 1990, TEGL Systems Corporation }
- { All Rights Reserved. }
- {-----------------------------------------------------------------------------}
- { }
- { TEGL's Graphic Interface has a different driver arrangement than that of }
- { Borland's BGI. Refer to the readme file for a one-to-one correspondence }
- { of driver modes and driver names to Borland's modes and names. }
- { }
- { This program demonstrates the linking of the TGI driver with the program }
- { code for a complete standalone graphic program. If you wish to try the }
- { the identical code with Borland's BGI, you can remove the comment brackets }
- { corresponding to the BGI driver and comment out the TGI code. }
- { }
- { Remeber to change tgraph to graph, otherwise you will get an invalid driver }
- { mode error when you attempt to link a BGI driver with TEGL. }
- { }
- { You should see a major difference in size and speed. TEGL's TGI is about }
- { 1/3 smaller than Borland's BGI and 2-6 times faster. }
- { }
- { To create the 'grevga16.obj' or 'egavga.obj' file, use the TGBINOBJ.EXE }
- { program in your TEGL utility directory to convert the 'grevga16.tgi' or }
- { 'egavga.bgi' respectively. }
- { }
- { C>tgbinobj grevga16.tgi }
- { }
- { C>tgbinobj egavga.bgi }
- { }
- {-----------------------------------------------------------------------------}
- { $define BGI}
-
- uses
- crt,
- {$ifdef BGI}
- graph;
- {$else}
- tgraph;
- {$endif}
-
- {$F+}
-
- {$ifdef BGI}
- Procedure egavga; External;
- {$L egavga.obj}
- {$else}
- Procedure grevga16; External;
- {$L grevga16.obj}
- {$endif}
-
- var gd,gm,i : integer;
- ch : char;
- driver : pointer;
- modenames: array[0..10] of string;
- activegm : string;
- oldgd : integer;
- maxmode : integer;
-
- begin
-
- {$ifdef BGI}
- driver := @egavga;
- {$else}
- driver := @grevga16;
- {$endif}
-
-
- {According to the manuals, registerbgidriver() should return the internal
- driver number. In the case of 'egavga' the internal graphic driver should
- have been 5 for EGA and 9 for VGA, however a quick display of the returned
- gd shows that the return value is 1.
-
- The TEGL drivers may be registered using the registerbgidriver(). 'gd'
- will always return a driver value of 11 and greater. You can use the
- original default values as provided by TGRAPH where gd := EGA, or
- use the new assigned graphic driver number. With the new graphic driver
- number, you can use the new extended modes provided the driver.
-
- Example. GREVGA16 provides up to 6 different video modes that you can
- try on your system. This includes the SVGA 800x600 mode number 2.
- }
-
-
- gd := registerbgidriver(driver);
- if gd<0 then
- begin
- writeln('Error registering driver:',GraphErrorMsg(GraphResult));
- halt(1);
- end;
-
- {$ifdef BGI}
- oldgd := gd;
- gd := vga;
- gm := vgahi;
- {$else}
- gm := 5;
- {$endif}
- initgraph(gd,gm,'');
-
- setcolor(blue);
- rectangle(0,0,getmaxx,getmaxy);
-
- while keypressed do ch:=readkey;
- while not keypressed do;
- while keypressed do ch:=readkey;
-
- activegm := getmodename(gm);
- maxmode := getmaxmode;
- for i:=0 to maxmode do
- modenames[i] := Getmodename(i);
-
- closegraph;
-
- writeln('Graphic Driver Name : ',GetDriverName,' Driver Number [',gd,'] Old GD [',oldgd,']');
- writeln('Active Mode Name : ',activegm,' Mode Number [',gm,']');
- for i:=0 to maxmode do
- writeln('Mode ',i,' Name : ',modenames[i]);
- end.
-