home *** CD-ROM | disk | FTP | other *** search
- {$A+,B-,D-,E+,F+,G+,I+,K-,L+,N-,O-,P-,Q-,R-,S+,T-,V+,W-,X+,Y+}
- {$M 16384,0}
- (*===================================================================*)
- (* PDEMO.PAS *)
- (* Demo für Grafik im Protected Mode unter Verwendung von DLLS *)
- (* in Borland Pascal 7.0/DPMI *)
- (* Copyright (C) 1993 te-wi Verlag München *)
- (*===================================================================*)
- (* Dieses Programm kann nicht mit Turbo Pascal compiliert werden *)
- (* Das Programm benötigt außerdem die DLL BGILIB.DLL und den *)
- (* Borland Pascal DOS-Extender um lauffähig zu sein. *)
- (*===================================================================*)
- PROGRAM PDemo; (* Protected-Mode Demonstration *)
-
- USES
- Crt, Graph, BGIImport;
-
- VAR
- gd, gm: INTEGER;
- s : STRING;
- ma : Real;
- i : INTEGER;
- BEGIN
- DetectGraph(gd, gm); (* Treiber ermitteln *)
- InitGraph(gd, gm, ''); (* Init mit BGILIB.DLL *)
- SetTextStyle(SmallFont, VertDir, 4); (* Copyright rechts hoch *)
- SetTextJustify(LeftText, BottomText);
- SetColor(Cyan); (* türkis *)
- OutTextXY(GetMaxX - 10, GetMaxY - 10, '(C) 1993 te-wi Verlag');
- SetColor(White); (* weiß *)
- Circle(GetMaxX DIV 2, GetMaxY DIV 2, GetMaxY DIV 2); (* Umkreis *)
- Circle(GetMaxX DIV 2, GetMaxY DIV 2, GetMaxY DIV 2 - 3);
- SetTextJustify(CenterText, CenterText); (* umdefinieren *)
- ma := MemAvail / 1024; (* Freien Speicher ermitteln *)
- ma := ma / 1024;
- Str(ma:2:3, s); (* ... und die Mbytes in einen String packen *)
- s := s + ' Mbytes RAM frei';
- s[Pos('.', s)] := ','; (* Punkt durch Komma ersetzen (nix USA! *)
- SetTextStyle(TriplexFont, HorizDir, 4); (* Messages ausgeben *)
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 4, 'Grafik mit Treiber-DLL');
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2, GetModeName(gm));
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + GetMaxY DIV 4, s);
- SetWriteMode(AndPut); (* erst mal AndPut *)
- i := 1;
- REPEAT
- IF i <= 1 THEN
- BEGIN
- Randomize; (* Zufallszähler *)
- SetColor(Random(GetMaxColor + 1)); (* Farbe durch Zufall *)
- SetWriteMode(Random(4)); (* WriteModus durch Zufall *)
- END; (* Kreis mit Interferenzen: *)
- Circle(GetMaxX DIV 2, GetMaxY DIV 2, i);
- Inc(i, 2);
- IF i = (GetMaxY DIV 2) THEN i := 0;
- IF i = (GetMaxY DIV 2) - 1 THEN i := 1;
- IF i > (GetMaxY DIV 2) - 3 THEN
- BEGIN
- SetColor(Black); (* Die Schrift sollte immer *)
- SetWriteMode(NormalPut); (* wieder upgedated werden *)
- ma := MemAvail / 1024;
- ma := ma / 1024;
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + GetMaxY DIV 4, s);
- Str(ma:2:3, s);
- s := s + ' Mbytes RAM frei';
- s[Pos('.', s)] := ',';
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 4,
- 'Grafik mit Treiber-DLL');
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2, GetModeName(gm));
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + GetMaxY DIV 4, s);
- END;
- UNTIL KeyPressed; (* ... bis beliebige Taste *)
- CloseGraph; (* ... und Ende *)
- END.
-