home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / dtx9302 / svga / xglite.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-02-17  |  5.2 KB  |  159 lines

  1. (*========================================================*)
  2. (*                   XGLITE.PAS v. 1.0                    *)
  3. (*             (C) 1993 Jörg Braun & DMV-Verlag           *)
  4. (*         Test-/Demoprogramm für die Unit XGRAPH         *)
  5. (*========================================================*)
  6. (* Benötigt werden:                                       *)
  7. (*      SVGA.BGI, TRIP.CHR, LCOM.CHR, SANS.CHR, GOTH.CHR, *)
  8. (*      SCRI.CHR, SIMP.CHR, EURO.CHR, TSCR.CHR, LITT.CHR, *)
  9. (*      EURO.CHR, außerdem die Unit XGRAPH und eventuell  *)
  10. (*      die Standard-BGI-Treiber (CGA, EGAVGA ....)       *)
  11. (* »MAKE« mit: MAKE -fXGLITE.MAK                          *)
  12. (* ====================================================== *)
  13. (* Das Programm zeigt einen Teil der Funktionen der Unit  *)
  14. (* XGraph in der Auflösung 800x600 Pixel                  *)
  15. (* ====================================================== *)
  16. (*    NICHT FÜR BORLAND PASCAL 7.0 DOS-PROTECTED-MODE !   *)
  17. (*========================================================*)
  18. {$I xgraph.h} {$M 16384,0,655360}
  19.  
  20. PROGRAM DemoProgramforXGraph;
  21.  
  22. USES
  23.   Dos, Crt, XGraph {, Drivers, Fonts, XFonts};
  24.  
  25. VAR
  26.   BoldFont,
  27.   gd, gm, MaxX, MaxY, i, j     : INTEGER;
  28.   TestStr, MaxColorStr, ModeStr,
  29.   MaxXStr, MaxYStr, jStr       : STRING;
  30.   ch                           : CHAR;
  31.   Multiplyer                   : WORD;
  32.  
  33. PROCEDURE WriteMsg;
  34. BEGIN
  35.   OutTextXY(MaxX - 20, 10, 'Aktueller Paletteneintrag: '
  36.                           + ModeStr);
  37. END;
  38.  
  39. BEGIN
  40.   Randomize;
  41.   ch := #0;
  42.   gd := detect;
  43.   InitGraph(gd, gm, GetEnv('BGIPATH'));
  44.   gm := GetMaxMode;
  45.   SetGraphMode(gm);
  46.   SetPalette(White, 63);
  47.   SetBkColor(Blue);
  48.   SetTextJustify(LeftText, CenterText);
  49.   SetTextStyle(0, HorizDir, 1);
  50.   MaxX := GetMaxX;
  51.   MaxY := GetMaxY;
  52.   Str(MaxX + 1, MaxXStr);
  53.   Str(MaxY + 1, MaxYStr);
  54.   Str(GetGraphMode, ModeStr);
  55.   Str(GetMaxColor + 1, MaxColorStr);
  56.   FontAttr := Bold;
  57.   OutTextXY(10, 10, GetModeName(gm) +
  58.             ', Treiber: ' + GetDriverName + ', Modus: ' +
  59.             ModeStr + ', Auflösung: ' + MaxXStr + '*' +
  60.             MaxYStr + ' Punkte, ' + MaxColorStr+ ' Farben');
  61.   FontAttr := Normal;
  62.   REPEAT
  63.     SetWriteMode(Random(NotPut));
  64.     i := 1;
  65.     REPEAT
  66.       SetColor(Random(GetMaxColor + 1));
  67.       Line(Random(MaxX),
  68.            Random(MaxY - MaxX DIV 30) + MaxX DIV 30,
  69.            Random(MaxX),
  70.            Random(MaxY - MaxX DIV 30) + MaxX DIV 30);
  71.       IF i MOD 100 = 0 THEN BEGIN
  72.         SetColor(Random(GetMaxColor) + 1);
  73.         SetFillStyle(Random(11), Random(GetMaxColor) + 1);
  74.         j := Random(MaxY - MaxY DIV 3) * 2 + 100;
  75.         PieSlice(Random(MaxX), j + 30, 0, 360,
  76.                  Random((MaxY DIV 4)));
  77.       END;
  78.       IF i MOD 150 = 0 THEN BEGIN
  79.         SetColor(Random(GetMaxColor) + 1);
  80.         SetFillStyle(Random(11), Random(GetMaxColor) + 1);
  81.         Bar(Random(MaxX),
  82.             Random(MaxY - MaxX DIV 30) + MaxX DIV 30,
  83.             Random(MaxX),
  84.             Random(MaxY - MaxX DIV 30) + MaxX DIV 30);
  85.       END;
  86.       IF i MOD 180 = 0 THEN BEGIN
  87.         SetColor(Random(GetMaxColor) + 1);
  88.         SetFillStyle(Random(11), Random(GetMaxColor) + 1);
  89.         FillEllipse(
  90.                 Random(MaxX),
  91.                 Random(MaxY) + 100,
  92.                 Random(MaxX DIV 8),
  93.                 Random(MaxY DIV 8));
  94.       END;
  95.       Inc(i);
  96.     UNTIL i > 1000;
  97.     IF KeyPressed THEN ch := ReadKey;
  98.   UNTIL ch <> #0;
  99.  
  100.   ClearDevice;
  101.   SetWriteMode(NormalPut);
  102.   SetBkColor(Black);
  103.   Multiplyer := MaxY DIV 12;
  104.   SetColor(White);
  105.   SetTextJustify(LeftText, CenterText);
  106.   OutTextXY(10, 10, 'Schriften-Demonstration:');
  107.   SetTextJustify(CenterText, CenterText);
  108.   BoldFont := InstallUserFont('BOLD');
  109.   FOR i := DefaultFont TO 11 DO BEGIN
  110.     IF i = 0 THEN
  111.       SetTextStyle(i, HorizDir, 2)
  112.     ELSE
  113.       SetTextStyle(i, HorizDir, 4);
  114.     CASE i OF
  115.       0:   TestStr := 'ROM-Zeichensatz';
  116.       1:   TestStr := 'Triplex-Font';
  117.       2:   TestStr := 'SmallFont';
  118.       3:   TestStr := 'SansSerif-Font';
  119.       4:   TestStr := 'Gothic-Font';
  120.       5:   TestStr := 'ScriptFont';
  121.       6:   TestStr := 'Simplex-Font';
  122.       7:   TestStr := 'Triplex-Font italic';
  123.       8:   TestStr := 'Triplex-Font light';
  124.       9:   TestStr := 'Euro-Font';
  125.      10:   TestStr := 'Bold-Font';
  126.       ELSE TestStr := 'Triplex-Font bold';
  127.            SetTextStyle(TriplexFont, HorizDir, 4);
  128.            FontAttr := Bold;
  129.     END;
  130.     OutTextXY(MaxX DIV 2, i * Multiplyer + Multiplyer - 30,
  131.               TestStr);
  132.   END;
  133.  
  134.   ch := #0;
  135.   i :=  63;
  136.   SetTextJustify(RightText, CenterText);
  137.   SetTextStyle(DefaultFont, HorizDir, 1);
  138.   FontAttr := Normal;
  139.   REPEAT
  140.     IF i > 127  THEN i := 0;
  141.     IF i < 0  THEN i := 127;
  142.     Str(i: 3, ModeStr);
  143.     SetPalette(White, i);
  144.     IF i IN [0, 64] THEN SetBkColor(LightBlue)
  145.                     ELSE SetBkColor(Black);
  146.     SetColor(White);
  147.     WriteMsg;
  148.     ch := ReadKey;
  149.     IF ch = '-' THEN Dec(i);
  150.     IF ch = '+' THEN Inc(i);
  151.     SetColor(GetBkColor);
  152.     WriteMsg;
  153.   UNTIL NOT (ch IN ['-', '+']);
  154.   CloseGraph;
  155. END.
  156.  
  157. (*========================================================*)
  158. (*                 Ende von XGDEMO.PAS                    *)
  159.