home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
insidetp
/
1990_08
/
test.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-06-20
|
2KB
|
91 lines
{************************************************
* TEST.PAS - Test frame to demonstrate device *
* independent graphics technique. *
************************************************}
USES
GRAPH,Crt,DOS;
PROCEDURE DrawStar(X,Y,Sx,Sy,C :Integer); FORWARD;
{$Define Test1}
{$IfDef Test1}
{$I Test1}
{$EndIf}
{$IfDef Test2}
{$I Test2}
{$EndIf}
PROCEDURE DrawStar(X, Y, Sx, Sy, C:Integer);
BEGIN
SetColor(C);
MoveTo(X - Sx, Y + Sy);
LineTo(X, Y - Sy);
LineTo(X + Sx, Y + Sy);
LineTo(X - Sx, Y);
LineTo(X + Sx, Y);
LineTo(X - Sx, Y + Sy)
END;
FUNCTION I2S(I: Integer): String;
{Function I2S interfaces to STR procedure so
we can automatically return a value INLINE}
VAR
TempStr : String[3];
BEGIN
Str(I,TempStr);
I2S := TempStr;
END;
VAR
I, J, GrDriver, GrError, GrMode,
GrMinMode, GrMaxMode : Integer;
BGIPath : PathStr;
BEGIN
{ Initialize graphics system }
BGIPath := GetEnv('BGI');
DetectGraph(GrDriver, GrMode);
IF (GrDriver < 0) THEN BEGIN
WriteLn('Error: no graphics hardware detec',
'ted! ',GrDriver);
Halt(1)
END;
{ Run through Drivers and legal modes }
FOR I := 1 TO GrDriver DO BEGIN
J := I;
GetModeRange(I, GrMinMode, GrMaxMode);
FOR GrMode := GrMinMode TO GrMaxMode DO BEGIN
InitGraph(J, GrMode, BGIPath);
GrError := GraphResult;
IF GrError < 0 THEN BEGIN
Textmode(C80);
WriteLn('Driver=',I:2,' Mode=',GrMode:2,
' Graphics error #',GrError:3);
WriteLn('Press Enter to continue');
ReadLn
END
ELSE BEGIN
OutText('Driver=' + I2S(I) + ' Mode=' +
I2S(GrMode) + ' MaxX=' +
I2S(GetMaxX) + ' MaxY=' +
I2S(GetMaxY));
OutTextXY(0, 10, 'Maximum Driver = ' +
I2S(GrDriver));
OutTextXY(0, 20, 'Min mode=' +
I2S(GrMinMode) + ' Max mode=' +
I2S(GrMaxMode));
DrawPict;
CloseGraph
END
END
END
END.