home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / das_buch / grafik / rdemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-05-09  |  3.2 KB  |  71 lines

  1. {$A+,B-,D-,E-,F-,G-,I-,K-,L-,N-,O-,P-,Q-,R-,S-,T-,V-,W-,X-,Y-}
  2. {$M 16384,0,655360}
  3. (*=================================================================*)
  4. (*                            RDEMO.PAS                            *)
  5. (*   Demo für Grafik im Protected Mode unter Verwendung von DLLS.  *)
  6. (*    Dieses Programm ist das Gegenstück zu PDemo und zeigt den    *)
  7. (*                 freien Speicher im Real-Mode an                 *)
  8. (*          Copyright (C) 1993 te-wi Verlag München                *)
  9. (*=================================================================*)
  10.  
  11. PROGRAM RDemo;                          (* Real-Mode Demonstration *)
  12.  
  13. USES
  14.   Crt, Dos, Graph;
  15.  
  16. VAR
  17.   gd, gm: INTEGER;
  18.   s     : STRING;
  19.   ma    : Real;
  20.   i     : INTEGER;
  21. BEGIN
  22.   DetectGraph(gd, gm);                        (* Treiber ermitteln *)
  23.   InitGraph(gd, gm, GetEnv('BGIPATH'));
  24.   SetTextStyle(SmallFont, VertDir, 4);    (* Copyright rechts hoch *)
  25.   SetTextJustify(LeftText, BottomText);
  26.   SetColor(Cyan);                                        (* türkis *)
  27.   OutTextXY(GetMaxX - 10, GetMaxY - 10, '(C) 1993 te-wi Verlag');
  28.   SetColor(White);                                         (* weiß *)
  29.   Circle(GetMaxX DIV 2, GetMaxY DIV 2, GetMaxY DIV 2);  (* Umkreis *)
  30.   Circle(GetMaxX DIV 2, GetMaxY DIV 2, GetMaxY DIV 2 - 3);
  31.   SetTextJustify(CenterText, CenterText);          (* umdefinieren *)
  32.   ma := MemAvail / 1024;              (* Freien Speicher ermitteln *)
  33.   Str(ma:3:0, s);     (* ... und die Kbytes in einen String packen *)
  34.   s := s + ' Kbytes RAM frei';
  35.   s[Pos('.', s)] := ',';   (* Punkt durch Komma ersetzen (nix USA! *)
  36.   SetTextStyle(TriplexFont, HorizDir, 4);     (* Messages ausgeben *)
  37.   OutTextXY(GetMaxX DIV 2, GetMaxY DIV 4, 'Grafik im Real-Mode');
  38.   OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2, GetModeName(gm));
  39.   OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + GetMaxY DIV 4, s);
  40.   SetWriteMode(AndPut);                         (* erst mal AndPut *)
  41.   i := 1;
  42.   REPEAT
  43.     IF i <= 1 THEN
  44.     BEGIN
  45.       Randomize;                                  (* Zufallszähler *)
  46.       SetColor(Random(GetMaxColor + 1));     (* Farbe durch Zufall *)
  47.       SetWriteMode(Random(4));          (* WriteModus durch Zufall *)
  48.     END;                               (* Kreis mit Interferenzen: *)
  49.     Circle(GetMaxX DIV 2, GetMaxY DIV 2, i);
  50.     Inc(i, 2);
  51.     IF i = (GetMaxY DIV 2)      THEN i := 0;
  52.     IF i = (GetMaxY DIV 2) - 1  THEN i := 1;
  53.     IF i > (GetMaxY DIV 2) - 3  THEN
  54.     BEGIN
  55.       SetColor(Black);                 (* Die Schrift sollte immer *)
  56.       SetWriteMode(NormalPut);         (* wieder upgedated werden  *)
  57.       ma := MemAvail / 1024;
  58.       OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + GetMaxY DIV 4, s);
  59.       Str(ma:3:0, s);
  60.       s := s + ' Kbytes RAM frei';
  61.       s[Pos('.', s)] := ',';
  62.       OutTextXY(GetMaxX DIV 2, GetMaxY DIV 4,
  63.                 'Grafik im Real-Mode');
  64.       OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2, GetModeName(gm));
  65.       OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + GetMaxY DIV 4, s);
  66.     END;
  67.   UNTIL KeyPressed;                     (* ... bis beliebige Taste *)
  68.   CloseGraph;                                      (* ... und Ende *)
  69. END.
  70.  
  71. (*=================================================================*)