home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / Gfx4PCQ.lha / WindowLib / Examples / Jumper3 / Jumper3.p < prev    next >
Encoding:
Text File  |  1997-02-09  |  1.0 KB  |  64 lines

  1. PROGRAM Jumper;
  2. {Another fractal generator for THOR's windowlib.
  3.  © 1997 THOR - Software}
  4.  
  5. {$I "Include:Utils/windowlib.i"}
  6.     
  7. VAR
  8.     a,b,c    :    REAL;
  9.     
  10.     window    :    WindowPtr;
  11.  
  12. {The iterator}    
  13. PROCEDURE Jumper(window : WindowPtr);
  14. VAR
  15.     x,y    :    REAL;
  16.     tmp    :    REAL;
  17.     i    :    INTEGER;
  18. BEGIN
  19.     
  20.     x:=0;
  21.     y:=0;
  22.  
  23.     {Tell the windowlib we want to hear close window events}
  24.     RequestStart(window,CLOSEWINDOW_f);
  25.     REPEAT    
  26.         Plot(window,x*32+320,64-y*16);
  27.  
  28.         tmp:=SQRT(ABS(b*x-c));
  29.         IF x=0 THEN
  30.             tmp:=y
  31.         ELSE BEGIN
  32.             IF x>0 THEN
  33.                 tmp:=y-tmp
  34.             ELSE    tmp:=y+tmp
  35.         END;
  36.         y:=a-x;
  37.         x:=tmp;
  38.         {repeat until user presses the close gadget}
  39.     UNTIL NextRequest(window)=CLOSEWINDOW_f;
  40.     
  41. END;
  42.     
  43. BEGIN
  44.     InitGraphics;        {setup the gfx system}
  45.     
  46.     {open a window on the WB screen}
  47.     window:=OpenScreenWindow(NIL,0,0,640,200,2+4+8,"Jumper");
  48.     
  49.     IF window<>NIL THEN BEGIN
  50.         a:=-3.14;
  51.         b:=0.3;
  52.         c:=0.3;
  53.         
  54.         Color(window,1);    {choose pen}
  55.         
  56.         Jumper(window);        {draw it}
  57.         
  58.         CloseAWindow(window);    {close the window}
  59.     END;
  60.  
  61.  
  62.     ExitGraphics;            {cleanup the gfx}
  63. END.
  64.