1 {$X+}
2
3 program AllModes;
4 {
5 * test and demo program for the Graph unit
6 *
7 * Please read the copyright notices of graph.pas
8 *
9 * This file is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 *
13 * Author : Sven Hilscher
14 * e-mail : sven@rufus.central.de
15 }
16
17 uses
18 Graph;
19
MyStrnull20 function MyStr(Numeric, Len: Integer):WrkString;
21 var
22 RetString : WrkString;
23 begin
24 str(Numeric:Len, RetString);
25 MyStr := RetString;
26 end;
27
28
29 var
30 i, c,
31 grDriver,
32 grMode,
33 ErrCode: Integer;
34
35 begin
36 grDriver := Detect;
37 { grDriver := InstallUserDriver('SVGA256', nil); Not used in GPC }
38 InitGraph(grDriver, grMode,'../../chr');
39 ErrCode := GraphResult;
40 if ErrCode = GrOk then
41 begin { Do graphics }
42 for i := 0 to GetMaxMode do
43 begin
44 SetGraphMode(i);
45
46 if GetMaxColor < 256 then
47 for c := 1 to GetMaxColor-1 do begin
48 begin
49 SetRGBPalette(c,c,0,255-c);
50 SetColor(c);
51 Line(c + 10, 5, c + 10, 30)
52 end;
53 SetRGBPalette(GetMaxColor,255,255,255);
54 SetColor(GetMaxColor)
55 end else begin
56 for c := 0 to 255 do
57 begin
58 SetColor(c);
59 Line(c + 10, 5, c + 10, 30)
60 end;
61 SetColor(White)
62 end;
63
64 OutTextXY(10,40, GetDriverName);
65 OutTextXY(10,50, 'Resolution : ' + MyStr(GetMaxX + 1, 4) + ' x' + MyStr(GetMaxY + 1, 4));
66 OutTextXY(10,60, 'Colors : ' + MyStr(GetMaxColor + 1, 10));
67 OutTextXY(10,80, 'ActMode : ' + MyStr(i , 4));
68 OutTextXY(10,90, 'ModeName : ' + GetModeName(i) );
69 OutTextXY(10,140,'Press Enter');
70
71 Rectangle(0,0,GetMaxX,GetMaxY);
72 Rectangle(2,2,GetMaxX-2,GetMaxY-2);
73
74 ReadKey;
75 end;
76 CloseGraph
77 end
78 else begin
79 Writeln('Graphics error:', GraphErrorMsg(ErrCode));
80 Write ('Press Enter ...');
81 ReadLn
82 end
83 end.
84
85