Advertisement
MrEfendi

Christmas tree (Choinka) in Graph Module - Pascal - BGI

May 22nd, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.56 KB | None | 0 0
  1. Uses Crt,Graph;
  2. var
  3.     sterownik,tryb,i,j:Integer;
  4.     t1: array[1..4] of PointType = ((X: 540; Y: 200), (X: 640; Y:100), (X: 740; Y: 200), (X: 540; Y: 200));
  5.     t2: array[1..4] of PointType = ((X: 500; Y: 310), (X: 640; Y:200), (X: 780; Y: 310), (X: 500; Y: 310));
  6.     t3: array[1..4] of PointType = ((X: 460; Y: 420), (X: 640; Y:310), (X: 820; Y: 420), (X: 460; Y: 420));
  7.     t4: array[1..4] of PointType = ((X: 420; Y: 530), (X: 640; Y:420), (X: 860; Y: 530), (X: 420; Y: 530)); //tree points
  8.  
  9. procedure bombka(x,y:integer); //to create staff on tree
  10.     begin
  11.         i:=random(12);
  12.         j:=random(12);
  13.         SetColor(red);
  14.         setfillstyle(i,j);
  15.         fillellipse(x,y,i,i);
  16.     end;
  17.    
  18. Begin
  19.     randomize;
  20.     Sterownik:=detect;
  21.     tryb:=9;
  22.     InitGraph(sterownik,tryb,'..\..\..\..\..\~PROGRAMY-GRY\notepad++\pascal\tp\BGI'); //link to bgi from turbopascal
  23.    
  24.     SetColor(red);
  25.     moveto(0,0);
  26.    
  27.     //wypelnienie
  28.         //niebieskie
  29.             setfillstyle(1,blue);
  30.             Bar(0,0,1280,980);
  31.        
  32.         //bialosc
  33.             setfillstyle(8,white);
  34.             Bar(0,700,1280,980);
  35.        
  36.         //kora
  37.             setfillstyle(1,brown);
  38.             Bar(600,530,680,750);
  39.        
  40.         //trojkat 1
  41.             setfillstyle(6,green);
  42.             setcolor(black);
  43.             fillpoly(3,t1);
  44.            
  45.         //trojkat 2
  46.             fillpoly(3,t2);
  47.            
  48.         //trojkat 3
  49.             fillpoly(3,t3);
  50.            
  51.         //trojkat 4
  52.             fillpoly(3,t4);
  53.            
  54.         //bombki
  55.             bombka(640,100);
  56.             bombka(500,310);
  57.             bombka(640,310);
  58.             bombka(780,310);
  59.             bombka(420,530);
  60.             bombka(860,530);
  61.            
  62.         //text
  63.         moveto(580,50);
  64.         outtext('HaHaHa, to jest choinka!'); //tree text
  65.            
  66.     repeat until keypressed;
  67.     CloseGraph;
  68.  
  69.     end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement