home *** CD-ROM | disk | FTP | other *** search
-
- PROGRAM horizon;
- (* Beispielprogramm für VGA-Grafik mit *)
- (* periodischem Durchlaufen von 256 Farben. *)
-
- USES Crt, MSGraph;
- CONST
- red = $00002a;
- grn = $002a00;
- blu = $2a0000;
- wht = $2a2a2a;
- step = 21;
- VAR
- vc : _VideoConfig;
- rainbow : ARRAY [1..512] OF LongInt;
- i, a : Integer;
- col, gray : LongInt;
- rec : _XYCoord;
-
- BEGIN (* Hauptprogramm *)
- a := _SetVideoMode( _MRes256Color );
- IF (a = 0) THEN
- BEGIN
- WriteLn( 'Programm benötigt VGA-Karte');
- Halt( 0 );
- END;
-
- FOR col := 0 TO 63 DO
- BEGIN
- gray := col OR (col SHL 8) OR (col SHL 16);
- rainbow[col] := blu AND gray;
- rainbow[col + 256] := blu AND gray;
- rainbow[col + 64] := blu OR gray;
- rainbow[col + 64 + 256] := blu OR gray;
- rainbow[col + 128] := red OR (wht AND NOT gray);
- rainbow[col + 128 + 256] := red OR (wht AND NOT gray);
- rainbow[col + 192] := red OR NOT gray;
- rainbow[col + 192 + 256] := red OR NOT gray;
- END;
- _SetViewOrg( 160, 85, rec );
-
- FOR i := 0 TO 254 DO
- BEGIN
- _SetColor( 255 - i );
- _MoveTo( i, i - 255 );
- _LineTo( -i, 255 - i );
- _MoveTo( -i, i - 255 );
- _LineTo( i, 255 - i );
- _Ellipse( _GBorder, -i, -i DIV 2, i, i DIV 2 );
- END;
-
- i := 0;
- WHILE NOT KeyPressed DO
- BEGIN
- _RemapAllPalette( rainbow[i]);
- i := i + step;
- IF i >= 256 THEN i := 0;
- END;
-
- a := _SetVideoMode( _DefaultMode );
- END.
-
-