home *** CD-ROM | disk | FTP | other *** search
/ Rat's Nest 1 / ratsnest1.iso / incoming / pas_sors.arj / KRU$H04.PAS < prev    next >
Pascal/Delphi Source File  |  1994-12-26  |  7KB  |  226 lines

  1. program Nice_Lines;
  2.  
  3. {  Hello again...                                        }
  4. {  This is version 0.10ß of Nice_Lines. It contains      }
  5. {  some very simple graphics routines using the Sine     }
  6. {  and the Cosine waves and normal lines. I repeat,      }
  7. {  it's nothing special, and will only be of help to     }
  8. {  beginners. You may modify this program as long as     }
  9. {  you don't distribute it after it has been modified.   }
  10. {                                     - Kru$H -95        }
  11.  
  12. {  ps. I think there might be more comments then code    }
  13. {      in this program/source/piece_of_shit, but what    }
  14. {      the hell.                                         }
  15.  
  16. {  If your pet snake kills you because you have used     }
  17. {  used this program, or if a piano lands on you in the  }
  18. {  middle of an open field, don't blame me.              }
  19.  
  20. uses crt, graph, dos;
  21. var  c, x, y, x1, y1    : integer;
  22.      gM, gT, i, i2      : integer;
  23.      a,b                : real;
  24.  
  25. Type DacPalette256 = array[0..255] of array[0..2] of Byte;
  26.  
  27. Const
  28.  
  29.   SVGA320x200x256       = 0;      { 320x200x256 Standard VGA }
  30.   SVGA640x400x256       = 1;      { 640x400x256 Svga         }
  31.   SVGA640x480x256       = 2;      { 640x480x256 Svga         }
  32.   SVGA800x600x256       = 3;      { 800x600x256 Svga         }
  33.   SVGA1024x768x256    = 4;    { 1024x768x256 Svga        }
  34.   TRANS_COPY_PIX       = 8;
  35.  
  36.  
  37.  
  38. procedure SetVGAPalette256(PalBuf : DacPalette256);
  39. var
  40.   Reg : Registers;
  41. begin
  42.   reg.ax := $1012;
  43.   reg.bx := 0;
  44.   reg.cx := 256;
  45.   reg.es := Seg(PalBuf);
  46.   reg.dx := Ofs(PalBuf);
  47.   intr($10,reg);
  48. end;
  49.  
  50.  
  51.  
  52. procedure graphic_stuff;
  53. begin
  54.   gM := InstallUserDriver ('SVGA256',nil);
  55.   gT := 3;
  56.   InitGraph (gM, gT, 'c:\tp');         { I hate this line, why can't tp  }
  57.   setcolor(15);                        { just find the damn BGI file?    }
  58.   randomize;
  59. end;
  60.  
  61.  
  62. procedure nice_lines1;                 { What happened to the blonde     }
  63. begin                                  { skydiver ?                      }
  64.   x:=0 ; y:=0 ; x1:=0 ; y1:=getmaxy;   { - She missed the earth.         }
  65.   for i:=0 to 5 do begin
  66.     for c:=32 to 65 do begin           { How does a blonde punctuate     }
  67.       Setcolor(c);                     { 'FUN FUN FUN WORRY WORRY WORRY' }
  68.       line(x,y,x1,y1);                 { - fun PERIOD fun PERIOD fun     }
  69.       inc( y,6);                       { NO PERIOD worry worry worry     }
  70.       inc(x1,8);
  71.     end;
  72.   end;
  73.   x:=0 ; y:=0 ; x1:=getmaxx ; y1:=0;
  74.   for i:=0 to 5 do begin
  75.     For c:=65 downto 32 do begin
  76.       Setcolor(c);
  77.       line(x,y,x1,y1);
  78.       inc(x,8);
  79.       inc(y1,6);
  80.     end;
  81.   end;
  82.   SetTextJustify(1,1);
  83.   Setcolor(35); OutTextXY(400,265,'The following Demonstration');
  84.   SetColor(36); OutTextXY(400,280,'of Sine and Cosine waves');
  85.   Setcolor(38); OutTextXY(400,295,'brought to you by:');
  86.   SetColor(40); OutTextXY(400,310,'Kru$H');
  87.   readkey;
  88. end;
  89.  
  90.  
  91. procedure halfway_house;
  92. begin
  93.   setcolor(14);
  94.   x:=0 ; y:=0 ; x1:=0 ; y1:=getmaxy;   { This could probably easily      }
  95.   for i:=0 to 100 do begin             { be shortened by making a        }
  96.     line(x,y,x1,y1);                   { different procedure for the     }
  97.     inc( y,6);                         { loop, but I'm too lazy to       }
  98.     inc(x1,8);                         { bother about it.                }
  99.   end;                                 { Why don't you try to fix it.    }
  100.   x:=0 ; y:=600 ; x1:=800 ; y1:=600;
  101.   for i:=0 to 100 do begin
  102.     line(x,y,x1,y1);
  103.     inc( x,8);
  104.     dec(y1,6);
  105.   end;
  106.   x:=0 ; y:=0 ; x1:=getmaxx ; y1:=0;
  107.   for i:=0 to 100 do begin
  108.     line(x,y,x1,y1);
  109.     inc( x,8);
  110.     inc(y1,6);
  111.   end;
  112.   x:=800 ; y:=0; x1:=0; y1:=0;
  113.   for i:=0 to 100 do begin
  114.     line(x,y,x1,y1);
  115.     dec( x,8);
  116.     inc(y1,6);
  117.   end;
  118.   readkey;
  119. end;
  120.  
  121.  
  122. procedure nice_lines2;
  123. begin
  124.   clearviewport;
  125.   SetLineStyle(0,0,3);            { Ooh... What thick lines you have. ;) }
  126.   x:=0 ; y:= 200 ;
  127.   SetColor(37); OutTextXY(100,155,'Sin-curve');
  128.   Moveto(x,y);
  129.   for i:=0 to 3 do begin
  130.     for c:=32 to 65 do begin
  131.       Setcolor(c);
  132.       inc(x,6) ; y1:=y+round(20*sin(x));  { This is quite a weird thing. }
  133.       lineto(x,y1);                       { If you want to enlarge the   }
  134.     end;                                  { wave, you have to work out   }
  135.   end;                                    { the proper relationships.    }
  136.  
  137.   SetColor(39); OuttextXY(100,355,'Cos-curve');
  138.   x:=0 ; y:= 400;
  139.   moveto(x,y);
  140.   for i:=0 to 3 do begin
  141.     for c:=32 to 65 do begin
  142.       SetColor(c);
  143.       inc(x,6); y1:=y+round(20*cos(x));   { And here it is again...      }
  144.       lineto(x,y1);
  145.     end;
  146.   end;
  147.   readkey;
  148. end;
  149.  
  150.  
  151.  
  152. procedure nice_lines3;      { Why were a blonde couple found frozen        }
  153. begin                       { at a drive-in movie in the spring ?          }
  154.   ClearViewPort;            { - They went to see 'Closed for the Winter'   }
  155.   SetLineStyle(0,0,2);
  156.   y:= 30 ; SetColor(37);
  157.   for i:=0 to 3 do begin
  158.     for c:=32 to 55 do begin
  159.     x:=0; moveto(x,y);
  160.       for i2:=0 to 134 do begin
  161.         Setcolor(c);
  162.         inc(x,6) ; y1:=y+round(20*sin(x));
  163.         lineto(x,y1);
  164.       end;
  165.       inc(y,3); x:=0;       { What is the difference between a chorus      }
  166.     end;                    { line of blondes and a magician ?             }
  167.   end; readkey;             { - A magician has a cunning array of stunts.. }
  168. end;
  169.  
  170. procedure nice_lines4;
  171.  
  172. procedure line_it(q,w :integer);
  173. begin
  174.   for i2:=0 to 50 do begin
  175.   x:=0; moveto(x,y);
  176.     for i:=0 to 7 do begin
  177.       for c:=q to w do begin
  178.         Setcolor(c);
  179.         inc(x,6) ; y1:=y+round(20*sin(x));
  180.         lineto(x,y1);
  181.       end;
  182.       for c:=w downto q do begin
  183.         SetColor(c);
  184.         inc(x,6) ; y1:=y+round(20*sin(x));
  185.         lineto(x,y1);
  186.       end;
  187.     end; inc(y,1);
  188.   end;
  189. end;
  190.  
  191. begin
  192.   ClearViewPort;
  193.   SetLineStyle(0,0,0);
  194.   y:=50    ; Line_IT(32,40);     { Here I actually bothered making a }
  195.   inc(y,10); Line_IT(41,49);     { seperate procedure for the loops  }
  196.   inc(y,12); Line_IT(36,44);
  197.   inc(y,15); Line_IT(23,31);
  198.   inc(y,19); Line_IT(16,24);
  199.   readkey;
  200. end;
  201.  
  202.  
  203. procedure The_End;
  204. begin
  205.   ClearViewPort; SetColor(yellow); SettextJustify(1,1);
  206.   OutTextXY(400,250,'Have a nice day');
  207.   delay(600);
  208.   for i:=0 to MaxInt do begin
  209.     PutPixel(330+random(140),240+random(20),0);
  210.   end;
  211. end;
  212.  
  213.  
  214. begin                            { Ta-Daa...  The Main Program !         }
  215.   graphic_stuff;
  216.   nice_lines1;                   { Why were all the blondes found on     }
  217.   halfway_house;                 { the roof of a house after a party ?   }
  218.   nice_lines2;                   { - Someone had told them that the      }
  219.   nice_lines3;                   {   drinks were on the house.           }
  220.   nice_lines4;
  221.   the_end;                       { The fuck stops here ;)                }
  222.   CloseGraph;
  223. end.                             { Hope you enjoyed this crap !          }
  224.  
  225.  
  226.