MrEfendi icon

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

MrEfendi | PRO | 05/22/13 09:20:04 PM UTC | 0 ⭐ | 246 👁️ | Never ⏰ | []
Pascal |

1.56 KB

|

None

|

0 👍

/

0 👎

Uses Crt,Graph;
var 
    sterownik,tryb,i,j:Integer; 
    t1: array[1..4] of PointType = ((X: 540; Y: 200), (X: 640; Y:100), (X: 740; Y: 200), (X: 540; Y: 200));
    t2: array[1..4] of PointType = ((X: 500; Y: 310), (X: 640; Y:200), (X: 780; Y: 310), (X: 500; Y: 310));
    t3: array[1..4] of PointType = ((X: 460; Y: 420), (X: 640; Y:310), (X: 820; Y: 420), (X: 460; Y: 420));
    t4: array[1..4] of PointType = ((X: 420; Y: 530), (X: 640; Y:420), (X: 860; Y: 530), (X: 420; Y: 530)); //tree points
 
procedure bombka(x,y:integer); //to create staff on tree
    begin
        i:=random(12);
        j:=random(12);
        SetColor(red);
        setfillstyle(i,j);
        fillellipse(x,y,i,i);
    end;
    
Begin
    randomize;
    Sterownik:=detect;
    tryb:=9;
    InitGraph(sterownik,tryb,'..\..\..\..\..\~PROGRAMY-GRY\notepad++\pascal\tp\BGI'); //link to bgi from turbopascal
    
    SetColor(red);
    moveto(0,0);
    
    //wypelnienie
        //niebieskie
            setfillstyle(1,blue);
            Bar(0,0,1280,980);
        
        //bialosc
            setfillstyle(8,white);
            Bar(0,700,1280,980);
        
        //kora
            setfillstyle(1,brown);
            Bar(600,530,680,750);
        
        //trojkat 1
            setfillstyle(6,green);
            setcolor(black);
            fillpoly(3,t1);
            
        //trojkat 2
            fillpoly(3,t2);
            
        //trojkat 3
            fillpoly(3,t3);
            
        //trojkat 4
            fillpoly(3,t4);
            
        //bombki
            bombka(640,100);
            bombka(500,310);
            bombka(640,310);
            bombka(780,310);
            bombka(420,530);
            bombka(860,530);
            
        //text
        moveto(580,50);
        outtext('HaHaHa, to jest choinka!'); //tree text
            
    repeat until keypressed;
    CloseGraph;
 
    end.

Comments