program DemoGrafico2;
{ -------------------------------------- }
{ TPDEMO2.p                              }
{                                        }
{ demo grafico                           }
{ PutPixel,LineRel,GetX,GetY,MoveTo      }
{ -------------------------------------- }
{ by Filippo Bosi                        }
{ Settembre 91 - VERSIONE TURBO PASCAL   }
{ -------------------------------------- }
{ N.B. per i commenti vedere la versione }
{      Kick Pascal.                      }

uses
  Crt, Graph;

var
  Gd, Gm : Integer;
  Color  : Word;
  Mx,My  : Word;

begin

  Gd := EGA64; InitGraph(Gd, Gm, '');
  if GraphResult <> grOk then Halt(1);

  Mx :=GetMaxX;
  My :=GetMaxY;

  Color := GetMaxColor;
  Randomize;

  { * ciclo principale * }
  repeat
    PutPixel(Random(GetMaxX),Random(GetMaxY),
             Random(Color));
    SetColor(Random(Color));
    LineRel(Random(11)-3,Random(11)-3);
    Delay(5);

    if (GetX>Mx) then MoveTo(0,GetY);
    if (GetY>My) then MoveTo(GetX,0);

  until KeyPressed;

  ReadLn;
  CloseGraph;
end.

