home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / qpdemo / beispiel / vga.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-08-24  |  1.5 KB  |  63 lines

  1.  
  2. PROGRAM horizon;
  3. (* Beispielprogramm für VGA-Grafik mit *)
  4. (* periodischem Durchlaufen von 256 Farben. *)
  5.  
  6. USES            Crt, MSGraph;
  7. CONST
  8.       red = $00002a;
  9.       grn = $002a00;
  10.       blu = $2a0000;
  11.       wht = $2a2a2a;
  12.       step = 21;
  13. VAR
  14.       vc : _VideoConfig;
  15.       rainbow : ARRAY [1..512] OF LongInt;
  16.       i, a : Integer;
  17.       col, gray : LongInt;
  18.       rec : _XYCoord;
  19.  
  20. BEGIN (* Hauptprogramm *)
  21.       a := _SetVideoMode( _MRes256Color );
  22.       IF (a = 0) THEN
  23.       BEGIN
  24.         WriteLn( 'Programm benötigt VGA-Karte');
  25.         Halt( 0 );
  26.       END;
  27.  
  28.       FOR col := 0 TO 63 DO
  29.       BEGIN
  30.         gray := col OR (col SHL 8) OR (col SHL 16);
  31.         rainbow[col] := blu AND gray;
  32.         rainbow[col + 256] := blu AND gray;
  33.         rainbow[col + 64] := blu OR gray;
  34.         rainbow[col + 64 + 256] := blu OR gray;
  35.         rainbow[col + 128] := red OR (wht AND NOT gray);
  36.         rainbow[col + 128 + 256] := red OR (wht AND NOT gray);
  37.         rainbow[col + 192] := red OR NOT gray;
  38.         rainbow[col + 192 + 256] := red OR NOT gray;
  39.       END;
  40.       _SetViewOrg( 160, 85, rec );
  41.  
  42.       FOR i := 0 TO 254 DO
  43.       BEGIN
  44.         _SetColor( 255 - i );
  45.         _MoveTo( i, i - 255 );
  46.         _LineTo( -i, 255 - i );
  47.         _MoveTo( -i, i - 255 );
  48.         _LineTo( i, 255 - i );
  49.         _Ellipse( _GBorder, -i, -i DIV 2, i, i DIV 2 );
  50.       END;
  51.  
  52.       i := 0;
  53.       WHILE NOT KeyPressed DO
  54.       BEGIN
  55.         _RemapAllPalette( rainbow[i]);
  56.         i := i + step;
  57.         IF i >= 256 THEN i := 0;
  58.       END;
  59.  
  60.       a := _SetVideoMode( _DefaultMode );
  61. END.
  62.  
  63.