home *** CD-ROM | disk | FTP | other *** search
- (*========================================================*)
- (* XGLITE.PAS v. 1.0 *)
- (* (C) 1993 Jörg Braun & DMV-Verlag *)
- (* Test-/Demoprogramm für die Unit XGRAPH *)
- (*========================================================*)
- (* Benötigt werden: *)
- (* SVGA.BGI, TRIP.CHR, LCOM.CHR, SANS.CHR, GOTH.CHR, *)
- (* SCRI.CHR, SIMP.CHR, EURO.CHR, TSCR.CHR, LITT.CHR, *)
- (* EURO.CHR, außerdem die Unit XGRAPH und eventuell *)
- (* die Standard-BGI-Treiber (CGA, EGAVGA ....) *)
- (* »MAKE« mit: MAKE -fXGLITE.MAK *)
- (* ====================================================== *)
- (* Das Programm zeigt einen Teil der Funktionen der Unit *)
- (* XGraph in der Auflösung 800x600 Pixel *)
- (* ====================================================== *)
- (* NICHT FÜR BORLAND PASCAL 7.0 DOS-PROTECTED-MODE ! *)
- (*========================================================*)
- {$I xgraph.h} {$M 16384,0,655360}
-
- PROGRAM DemoProgramforXGraph;
-
- USES
- Dos, Crt, XGraph {, Drivers, Fonts, XFonts};
-
- VAR
- BoldFont,
- gd, gm, MaxX, MaxY, i, j : INTEGER;
- TestStr, MaxColorStr, ModeStr,
- MaxXStr, MaxYStr, jStr : STRING;
- ch : CHAR;
- Multiplyer : WORD;
-
- PROCEDURE WriteMsg;
- BEGIN
- OutTextXY(MaxX - 20, 10, 'Aktueller Paletteneintrag: '
- + ModeStr);
- END;
-
- BEGIN
- Randomize;
- ch := #0;
- gd := detect;
- InitGraph(gd, gm, GetEnv('BGIPATH'));
- gm := GetMaxMode;
- SetGraphMode(gm);
- SetPalette(White, 63);
- SetBkColor(Blue);
- SetTextJustify(LeftText, CenterText);
- SetTextStyle(0, HorizDir, 1);
- MaxX := GetMaxX;
- MaxY := GetMaxY;
- Str(MaxX + 1, MaxXStr);
- Str(MaxY + 1, MaxYStr);
- Str(GetGraphMode, ModeStr);
- Str(GetMaxColor + 1, MaxColorStr);
- FontAttr := Bold;
- OutTextXY(10, 10, GetModeName(gm) +
- ', Treiber: ' + GetDriverName + ', Modus: ' +
- ModeStr + ', Auflösung: ' + MaxXStr + '*' +
- MaxYStr + ' Punkte, ' + MaxColorStr+ ' Farben');
- FontAttr := Normal;
- REPEAT
- SetWriteMode(Random(NotPut));
- i := 1;
- REPEAT
- SetColor(Random(GetMaxColor + 1));
- Line(Random(MaxX),
- Random(MaxY - MaxX DIV 30) + MaxX DIV 30,
- Random(MaxX),
- Random(MaxY - MaxX DIV 30) + MaxX DIV 30);
- IF i MOD 100 = 0 THEN BEGIN
- SetColor(Random(GetMaxColor) + 1);
- SetFillStyle(Random(11), Random(GetMaxColor) + 1);
- j := Random(MaxY - MaxY DIV 3) * 2 + 100;
- PieSlice(Random(MaxX), j + 30, 0, 360,
- Random((MaxY DIV 4)));
- END;
- IF i MOD 150 = 0 THEN BEGIN
- SetColor(Random(GetMaxColor) + 1);
- SetFillStyle(Random(11), Random(GetMaxColor) + 1);
- Bar(Random(MaxX),
- Random(MaxY - MaxX DIV 30) + MaxX DIV 30,
- Random(MaxX),
- Random(MaxY - MaxX DIV 30) + MaxX DIV 30);
- END;
- IF i MOD 180 = 0 THEN BEGIN
- SetColor(Random(GetMaxColor) + 1);
- SetFillStyle(Random(11), Random(GetMaxColor) + 1);
- FillEllipse(
- Random(MaxX),
- Random(MaxY) + 100,
- Random(MaxX DIV 8),
- Random(MaxY DIV 8));
- END;
- Inc(i);
- UNTIL i > 1000;
- IF KeyPressed THEN ch := ReadKey;
- UNTIL ch <> #0;
-
- ClearDevice;
- SetWriteMode(NormalPut);
- SetBkColor(Black);
- Multiplyer := MaxY DIV 12;
- SetColor(White);
- SetTextJustify(LeftText, CenterText);
- OutTextXY(10, 10, 'Schriften-Demonstration:');
- SetTextJustify(CenterText, CenterText);
- BoldFont := InstallUserFont('BOLD');
- FOR i := DefaultFont TO 11 DO BEGIN
- IF i = 0 THEN
- SetTextStyle(i, HorizDir, 2)
- ELSE
- SetTextStyle(i, HorizDir, 4);
- CASE i OF
- 0: TestStr := 'ROM-Zeichensatz';
- 1: TestStr := 'Triplex-Font';
- 2: TestStr := 'SmallFont';
- 3: TestStr := 'SansSerif-Font';
- 4: TestStr := 'Gothic-Font';
- 5: TestStr := 'ScriptFont';
- 6: TestStr := 'Simplex-Font';
- 7: TestStr := 'Triplex-Font italic';
- 8: TestStr := 'Triplex-Font light';
- 9: TestStr := 'Euro-Font';
- 10: TestStr := 'Bold-Font';
- ELSE TestStr := 'Triplex-Font bold';
- SetTextStyle(TriplexFont, HorizDir, 4);
- FontAttr := Bold;
- END;
- OutTextXY(MaxX DIV 2, i * Multiplyer + Multiplyer - 30,
- TestStr);
- END;
-
- ch := #0;
- i := 63;
- SetTextJustify(RightText, CenterText);
- SetTextStyle(DefaultFont, HorizDir, 1);
- FontAttr := Normal;
- REPEAT
- IF i > 127 THEN i := 0;
- IF i < 0 THEN i := 127;
- Str(i: 3, ModeStr);
- SetPalette(White, i);
- IF i IN [0, 64] THEN SetBkColor(LightBlue)
- ELSE SetBkColor(Black);
- SetColor(White);
- WriteMsg;
- ch := ReadKey;
- IF ch = '-' THEN Dec(i);
- IF ch = '+' THEN Inc(i);
- SetColor(GetBkColor);
- WriteMsg;
- UNTIL NOT (ch IN ['-', '+']);
- CloseGraph;
- END.
-
- (*========================================================*)
- (* Ende von XGDEMO.PAS *)
-