Program DJGraphicsDemo;

Uses DJVGA,Crt;

Var R1,R2,I,I1,I2:Integer;

Function KeyPressed:Boolean; Assembler;
ASM
   MOV AH,0BH   { check if key has been pressed? }
   INT 21H      { call dos }
   AND AL,AL    { if a key pending ? }
   JZ  @no      { nope }
   MOV AL,True  { yupe }
@no:
End;

Procedure WaitKey; Assembler;
ASM
   MOV AH,1
   INT 21H
End;

Begin
   { set mode 320x200x16 mode, you can also use just about any other EGA/VGA
     mode available }
   DJ_SetVideoMode($0D);

   { Test Line Procedures }
   { draw box around screen }
   DJ_Line(10,10,300,10,12);
   DJ_Line(300,10,300,180,12);
   DJ_Line(300,180,10,180,12);
   DJ_Line(10,180,10,10,12);
   WaitKey;
   DJ_ClrScr;

   Repeat
     R1 := Random(14)+1;
     R2 := Random(14)+1;
     For I1 := 1 To 200 Do
     Begin
         For I2 := 1 To 200 Do
         Begin
             DJ_DPutPixel(I1,I2,R1);
             DJ_DPutPixel(I2,I1,R2);
         End;
     End;
   Until KeyPressed;
   { clear the keypress }
   WaitKey;
   DJ_ClrScr;

   For I := 1 To 100 Do DJ_DPutPixel(Random(319)+1,Random(199)+1,Random(14)+1);

   For I1 := 1 To 320 Do
   Begin
       For I2 := 1 To 200 Do
       Begin
           If DJ_DGetPixel(I1,I2) > 0 Then DJ_DPutPixel(I1,I2,0);  { change to black }
       End;
   End;

   WaitKey;

   { Filled_Rectangle Demonstration }
   DJ_Filled_Rectangle(0,0,320,200,15);  { Fill Screen with white }
   WaitKey;

   { Fade Demonstration }
   DJ_Filled_Rectangle(0,0,320,200,0);   { Fill Screen with black }
   DJ_Fade(MaxPix+500,11);               { Fade into a cyan color }
   WaitKey;

   { Lines from screen center Demonstration }
   DJ_Filled_Rectangle(0,0,320,200,0);   { Fill Screen with black }
   Repeat
       DJ_Lines_From_Center(Random(15)+1,95);          { Draw a bunch of lines }
       Delay(140);
       DJ_Lines_From_Center(Random(15)+1,100);          { Draw a bunch of lines }
       Delay(140);
       DJ_Lines_From_Center(Random(15)+1,105);          { Draw a bunch of lines }
       Delay(140);
       DJ_Lines_From_Center(Random(15)+1,110);          { Draw a bunch of lines }
       Delay(140);
       DJ_Lines_From_Center(Random(15)+1,115);          { Draw a bunch of lines }
       Delay(140);    { Need delay, screen drawing way too fast to see! }
       DJ_Filled_Rectangle(0,0,320,200,0);   { Clear Screen }
   Until KeyPressed;
   WaitKey;

   { Ellipse/Circle Demonstration }
   DJ_Ellipse(110,100,60,50,15);         { Draw Bunch of Neat Circles }
   DJ_Ellipse(120,100,65,55,12);
   DJ_Ellipse(130,100,70,60,11);
   DJ_Ellipse(140,100,75,65,10);
   DJ_Ellipse(115,100,80,70,9);
   DJ_Ellipse(125,100,85,75,8);
   DJ_Ellipse(135,100,90,80,7);
   DJ_Ellipse(140,100,95,85,13);
   DJ_Ellipse(145,100,100,90,14);
   WaitKey;

   { return to text mode }
   DJ_SetVideoMode($03);
End.

