예제 #1
0
파일: Form1.cs 프로젝트: nixon-by/MG_1
 private void AddFigures()
 {
     Point c1 = new Point(10, 20);
     Point c2 = new Point((int)screenW-10, 20);
     leftCar = new SportCar(c1,int.Parse(leftSpeed.Text));
     rightCar = new Truck(c2, -int.Parse(rightSpeed.Text));
 }
예제 #2
0
파일: Triangle.cs 프로젝트: nixon-by/MG_1
        public void Draw(Car car)
        {
            if (isRotate)
            {
                Gl.glPushMatrix();
                Gl.glTranslated(150, -270, 0);
                Gl.glRotated(rotateAngle, 0, 0, 1);

                if (rotateAngle < 50)
                {
                    rotateAngle += 1;
                }
            }

            Gl.glColor3f(red, green, blue);
            Gl.glBegin(Gl.GL_TRIANGLES);

            Gl.glVertex2d(d1.X, d1.Y);
            Gl.glVertex2d(d2.X, d2.Y);
            Gl.glVertex2d(d3.X, d3.Y);

            Gl.glEnd();

            if (isRotate)
            {
                Gl.glPopMatrix();
            }
        }
예제 #3
0
파일: Circle.cs 프로젝트: nixon-by/MG_1
 public void Draw(Car car)
 {
     Gl.glColor3f(red, green, blue);
     Gl.glBegin(Gl.GL_TRIANGLE_FAN);
     Gl.glVertex2f(d1.X, d1.Y);
     for (int i = 0; i <= radius; i++)
     {
         float _tmpPoint = (float)i / (float)radius * 3.1415f * 2.0f;
         Gl.glVertex2d(d1.X + Math.Cos(_tmpPoint) * (radius),
           d1.Y + Math.Sin(_tmpPoint) * (radius));
     }
     Gl.glEnd();
 }
예제 #4
0
파일: Quad.cs 프로젝트: nixon-by/MG_1
        public void Draw(Car car)
        {
            if (isRotate)
            {
                Gl.glPushMatrix();
                //Gl.glTranslated(150, -270, 0);
                Gl.glTranslated(Rx, Ry, 0);

                Gl.glRotated(Dir * rotateAngle, 0, 0, 1);
                if (rotateAngle < DegLim)
                {
                    rotateAngle += 1;
                }

                if (!resX)
                {
                    IncrementX(-Rx);
                    resX = true;
                }
            }

            Gl.glColor3f(red, green, blue);
            Gl.glBegin(Gl.GL_QUADS);

            Gl.glVertex2d(d1.X, d1.Y);
            Gl.glVertex2d(d2.X, d2.Y);
            Gl.glVertex2d(d3.X, d3.Y);
            Gl.glVertex2d(d4.X, d4.Y);

            Gl.glEnd();

            if (isRotate)
            {

                Gl.glPopMatrix();
            }
        }