Ejemplo n.º 1
0
 public draw()
     : base()
 {
     this.KeyDown   += new KeyEventHandler(LessonView_KeyDown);
     this.KeyUp     += new KeyEventHandler(LessonView_KeyUp);
     this.finished   = false;
     r1              = new Random(r.Next());
     t1              = new My_time();
     ttime2          = new Two_time();
     t1.Interval     = 2000;
     ttime2.Interval = 1000;
     MyBall          = new List_My_Ball();
     limyba.Add(MyBall1);
     limyba.Add(MyBall2);
     limyba.Add(MyBall3);
 }
Ejemplo n.º 2
0
 public void AddTball(List_My_Ball MyBall, int start, int end)
 {
     for (int i = start; i < end; i++)
     {
         if (MyBall.lmp1[i].counter < as12.MyPath.Count)
         {
             MyBall.lmp1[i].counter++;
         }
     }
     if (MyBall.lmp1.Count < 6)
     {
         a           = r1.Next(6);
         this.ttball = new Tball(as12.MyPath[0].x, as12.MyPath[0].y, 0, 0, a);
         MyBall.lmp1.Insert(MyBall.lmp1.Count, ttball);
     }
 }
Ejemplo n.º 3
0
        public void MoveBall(List_My_Ball MyBall)
        {
            for (int i = 0; (i < MyBall.lmp1.Count) && (t1.Enabled); i++)
            {
                if (MyBall.lmp1[i].counter < as12.MyPath.Count)
                {
                    GL.glLoadIdentity();
                    GL.glTranslatef(0, 0, this.z);

                    GL.glTranslatef(as12.MyPath[MyBall.lmp1[i].counter].x, as12.MyPath[MyBall.lmp1[i].counter].y, as12.MyPath[MyBall.lmp1[i].counter].z);
                    if (MyBall.lmp1[i].data == 1)
                    {
                        GL.glColor3fv(mycolor.yellow);
                    }
                    if (MyBall.lmp1[i].data == 0)
                    {
                        GL.glColor3fv(mycolor.green);
                    }
                    if (MyBall.lmp1[i].data == 2)
                    {
                        GL.glColor3fv(mycolor.magneta);
                    }
                    if (MyBall.lmp1[i].data == 3)
                    {
                        GL.glColor3fv(mycolor.blue);
                    }
                    if (MyBall.lmp1[i].data == 4)
                    {
                        GL.glColor3fv(mycolor.cyan);
                    }
                    if (MyBall.lmp1[i].data == 5)
                    {
                        GL.glColor3fv(mycolor.red);
                    }
                    sphere1.getbox();
                }
            }
        }
Ejemplo n.º 4
0
        protected override void InitGLContext()
        {
            loading.LoadTextures1(2);
            MyBall2 = new List_My_Ball();
            xb      = zb = 0;
            yy      = yb = -1.2f;
            GL.glEnable(GL.GL_TEXTURE_2D);                                      // Enable Texture Mapping
            GL.glShadeModel(GL.GL_SMOOTH);                                      // Enable Smooth Shading
            GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);                            // Black Background
            GL.glClearDepth(1.0f);                                              // Depth Buffer Setup
            GL.glEnable(GL.GL_DEPTH_TEST);                                      // Enables Depth Testing
            GL.glDepthFunc(GL.GL_LEQUAL);                                       // The Type Of Depth Testing To Do
            GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);         // Really Nice Perspective Calculations

            GL.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, this.LightAmbient);       // Setup The Ambient Light
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, this.LightDiffuse);       // Setup The Diffuse Light
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, this.LightPosition);     // Position The Light
            GL.glEnable(GL.GL_LIGHT1);                                          // Enable Light One
            if (this.light)                                                     // If lighting, enable it to start
            {
                GL.glEnable(GL.GL_LIGHTING);
            }
        }