예제 #1
0
 public Universe(Graphics g)
 {
     this.g = g;
     space  = new HinhChuNhat(new Point(5, 5), new Point(1340, 770), Color.Black);
     tam    = new Point(680, 385);
     quydao = new HinhTron(300, tam, Color.White);
     sun    = new HinhTron(100, tam, Color.FromArgb(246, 166, 0));
     earth  = new HinhTron(50, new Point(tam.X + 300, tam.Y), Color.White);
     truc   = new Line(new Point(earth.Point.X - earth.Radius, earth.Point.Y), new Point(earth.Point.X + earth.Radius, earth.Point.Y), Color.White);
 }
예제 #2
0
        public Car2d(Graphics g)
        {
            this.g = g;

            banh1 = new HinhTron(25, new Point(550, 650), Color.Black);
            banh2 = new HinhTron(25, new Point(700, 650), Color.Black);

            vanh1 = new HinhTron(banh1.Radius + 10, banh1.Point, Color.Black);
            vanh2 = new HinhTron(banh2.Radius + 10, banh2.Point, Color.Black);

            trucBanh1 = new Line(new Point(banh1.Point.X, banh1.Point.Y - banh1.Radius), new Point(banh1.Point.X, banh1.Point.Y + banh1.Radius), Color.Black);
            trucBanh2 = new Line(new Point(banh2.Point.X, banh2.Point.Y - banh2.Radius), new Point(banh2.Point.X, banh2.Point.Y + banh2.Radius), Color.Black);

            thanxe = new HinhChuNhat(new Point(banh1.Point.X - 100, banh1.Point.Y - 70), new Point(banh2.Point.X + 100, banh2.Point.Y), Color.Black);
            nocxe  = new HinhThangCan(new Point(banh1.Point.X + 20, banh1.Point.Y - 140), new Point(banh2.Point.X + 20, banh2.Point.Y - 70), Color.Black, 30);

            l1 = new Line(new Point(banh1.Point.X + 80, banh1.Point.Y - 135), new Point(banh1.Point.X + 80, banh2.Point.Y - 75), Color.Red);

            light = new HinhTron(10, new Point(banh1.Point.X - 70, banh1.Point.Y - 40), Color.Black);
        }
예제 #3
0
        public Hinh1(Graphics g)
        {
            this.g  = g;
            c       = new Car2d(this.g);
            sun     = new Sun(new Point(280, 70), 70);
            moon    = new Moon(new Point(250, 70), 50);
            nenTroi = new HinhChuNhat(new Point(0, 0), new Point(1350, 600), Color.FromArgb(62, 155, 244));

            d            = new HinhChuNhat(new Point(0, 600), new Point(toadoXMax, 800), Color.Black);
            vachkeDuong1 = new Line(new Point(136, toadoY), new Point(340, toadoY), Color.Black);
            vachkeDuong2 = new Line(new Point(476, toadoY), new Point(680, toadoY), Color.Black);
            vachkeDuong3 = new Line(new Point(816, toadoY), new Point(1020, toadoY), Color.Black);
            vachkeDuong4 = new Line(new Point(1156, toadoY), new Point(1360, toadoY), Color.Black);

            vachkeDuong5 = new Line(Transformations.TinhTien(vachkeDuong1.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong1.B, -toadoXMax, 0), Color.Black);
            vachkeDuong6 = new Line(Transformations.TinhTien(vachkeDuong2.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong2.B, -toadoXMax, 0), Color.Black);
            vachkeDuong7 = new Line(Transformations.TinhTien(vachkeDuong3.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong3.B, -toadoXMax, 0), Color.Black);
            vachkeDuong8 = new Line(Transformations.TinhTien(vachkeDuong4.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong4.B, -toadoXMax, 0), Color.Black);

            house1 = new HinhChuNhat(new Point(350, 220), new Point(500, 600), Color.Black);
            house2 = new HinhChuNhat(new Point(270, 400), new Point(200, 600), Color.Black);
            house3 = new HinhChuNhat(new Point(340, 300), new Point(280, 600), Color.Black);

            windowns1 = new HinhChuNhat(new Point(370, 580), new Point(400, 600), Color.Black);
            windowns2 = new HinhChuNhat(new Point(370, 530), new Point(400, 550), Color.Black);
            windowns3 = new HinhChuNhat(new Point(370, 480), new Point(400, 500), Color.Black);
            windowns4 = new HinhChuNhat(new Point(370, 430), new Point(400, 450), Color.Black);
            windowns5 = new HinhChuNhat(new Point(370, 380), new Point(400, 400), Color.Black);
            windowns6 = new HinhChuNhat(new Point(370, 330), new Point(400, 350), Color.Black);
            windowns7 = new HinhChuNhat(new Point(370, 280), new Point(400, 300), Color.Black);
            windowns8 = new HinhChuNhat(new Point(370, 230), new Point(400, 250), Color.Black);

            windowns11 = new HinhChuNhat(new Point(450, 580), new Point(480, 600), Color.Black);
            windowns12 = new HinhChuNhat(new Point(450, 530), new Point(480, 550), Color.Black);
            windowns13 = new HinhChuNhat(new Point(450, 480), new Point(480, 500), Color.Black);
            windowns14 = new HinhChuNhat(new Point(450, 430), new Point(480, 450), Color.Black);
            windowns15 = new HinhChuNhat(new Point(450, 380), new Point(480, 400), Color.Black);
            windowns16 = new HinhChuNhat(new Point(450, 330), new Point(480, 350), Color.Black);
            windowns17 = new HinhChuNhat(new Point(450, 280), new Point(480, 300), Color.Black);
            windowns18 = new HinhChuNhat(new Point(450, 230), new Point(480, 250), Color.Black);


            windowns21 = new HinhChuNhat(new Point(330, 580), new Point(290, 600), Color.Black);
            windowns22 = new HinhChuNhat(new Point(330, 530), new Point(290, 550), Color.Black);
            windowns23 = new HinhChuNhat(new Point(330, 480), new Point(290, 500), Color.Black);
            windowns24 = new HinhChuNhat(new Point(330, 430), new Point(290, 450), Color.Black);
            windowns25 = new HinhChuNhat(new Point(330, 380), new Point(290, 400), Color.Black);
            windowns26 = new HinhChuNhat(new Point(330, 330), new Point(290, 350), Color.Black);


            windowns31 = new HinhChuNhat(new Point(250, 580), new Point(220, 600), Color.Black);
            windowns32 = new HinhChuNhat(new Point(250, 530), new Point(220, 550), Color.Black);
            windowns33 = new HinhChuNhat(new Point(250, 480), new Point(220, 500), Color.Black);
            windowns34 = new HinhChuNhat(new Point(250, 430), new Point(220, 450), Color.Black);

            //cai cay xanhxanh
            thanCay = new HinhChuNhat(new Point(820, 480), new Point(850, 600), Color.Black);
            laCay   = new HinhTamGiac(new Point(835, 300), new Point(750, 495), new Point(920, 495), Color.Black);
            //cot den
            trafficlights1 = new HinhChuNhat(new Point(1100, 400), new Point(1110, 600), Color.Black);
            trafficlights2 = new HinhChuNhat(new Point(1050, 390), new Point(1160, 400), Color.Black);
            //bong den
            lightbulbL = new HinhTron(15, new Point(1050, 405), Color.Black);
            lightbulbR = new HinhTron(15, new Point(1160, 405), Color.Black);
            //Cloud
            cloud1 = new HinhTron(35, new Point(900, 100), Color.Black);
            cloud2 = new HinhTron(35, new Point(950, 100), Color.Black);
            cloud3 = new HinhTron(35, new Point(1000, 100), Color.Black);
            cloud4 = new HinhTron(35, new Point(950, 125), Color.Black);
            cloud5 = new HinhTron(28, new Point(400, 80), Color.Black);
            cloud6 = new HinhTron(28, new Point(430, 80), Color.Black);
            cloud7 = new HinhTron(28, new Point(460, 80), Color.Black);
            cloud8 = new HinhTron(28, new Point(430, 100), Color.Black);
        }