Exemplo n.º 1
0
        public RubikCubeForm()
        {
            InitializeComponent();
            this.timer     = new Timer();
            timer.Tick    += Tick;
            timer.Enabled  = true;
            timer.Interval = 1;
            timer.Start();

            OpenGlControl.Width  = this.Width;
            OpenGlControl.Height = this.Height;
            OpenGlControl.InitializeContexts();

            rubiksCube = new RubiksCube();
            lights     = new List <Light>();

            var lightFront = new Light(Gl.GL_LIGHT0, new float[3] {
                0.0f, 0.0f, 3f
            });

            lights.Add(lightFront);
            //var lightBack = new Light(Gl.GL_LIGHT0, new float[3] { 0f, 0f, 3f });
            //lights.Add(lightBack);

            this.Initialize();
        }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            OpenGlControl.InitializeContexts();
            int height = OpenGlControl.Height;
            int width  = OpenGlControl.Width;

            Gl.glEnable(Gl.GL_LIGHTING);
            Gl.glEnable(Gl.GL_LIGHT0);
            float[] light_pos = new float[4] {
                1, 0.5F, 1, 0
            };
            Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, light_pos);
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glDepthFunc(Gl.GL_LEQUAL);
            Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);
            Gl.glClearColor(0, 0, 0, 1);

            Gl.glViewport(0, 0, width, height);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluPerspective(45.0f, (double)width / (double)height, 0.01f, 5000.0f);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);

            var objLoaderFactory = new ObjLoaderFactory();
            var objLoader        = objLoaderFactory.Create();

            var fileStream = new FileStream("bardak.obj", FileMode.Open, FileAccess.Read);

            result = objLoader.Load(fileStream);
        }
Exemplo n.º 3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            switch (menu)
            {
            case 0:
            {
                Doodle_Jump.Menu.ObjectMenu.RenderGlobalMenu();
                break;
            }

            case 1:
            {
                RenderScene();

                break;
            }

            case 2:
            {
                doodle.GameOver(doodle, map, objects_menu);
                if ((gameMenuSound == false) && (sounds.OffSound == false) && (durkaFlag == false))
                {
                    sounds.ESound4.Play();
                    gameMenuSound = true;
                }
                Doodle_Jump.Doodler.Score.WritingFile(map);
                break;
            }

            case 3:
            {
                Doodle_Jump.Menu.ObjectMenu.RenderTop10(objects_menu);
                Doodler.Score.ReadingFile();
                Doodle_Jump.Doodler.Score.WritingFile(map);
                break;
            }

            case 4:
            {
                Doodle_Jump.Menu.ObjectMenu.RenderEnterName(objects_menu);
                Gl.glColor4ub(105, 52, 20, 255);
                Texture.Texture.PrintText2DPoint(230.0f, 355.0f, MainForm.DoodlerName);
                break;
            }

            case 5:
            {
                HelpMenuDraw();
                break;
            }
            }

            OpenGlControl.Invalidate();
        }
Exemplo n.º 4
0
 private void buttonY_MouseClick(object sender, MouseEventArgs e)
 {
     if (invert)
     {
         beta -= 5;
     }
     else
     {
         beta += 5;
     }
     beta        = (beta + 360) % 360;
     labelY.Text = beta.ToString();
     OpenGlControl.Refresh();
 }
Exemplo n.º 5
0
 private void buttonX_MouseClick(object sender, MouseEventArgs e)
 {
     if (invert)
     {
         alfa -= 5;
     }
     else
     {
         alfa += 5;
     }
     alfa        = (alfa + 360) % 360;
     labelX.Text = alfa.ToString();
     OpenGlControl.Refresh();
 }
Exemplo n.º 6
0
 private void buttonZ_MouseClick(object sender, MouseEventArgs e)
 {
     if (invert)
     {
         gamma -= 5;
     }
     else
     {
         gamma += 5;
     }
     gamma       = (gamma + 360) % 360;
     labelZ.Text = gamma.ToString();
     OpenGlControl.Refresh();
 }
Exemplo n.º 7
0
        public Form1()
        {
            InitializeComponent();
            OpenGlControl.InitializeContexts();
            //OpenGl ilk işlemler
            Gl.glClearColor(0.1f, 0.2f, 0.2f, 1.0f);   //Ekranı mavi bir renk ile sileceğim demek
            Gl.glMatrixMode(Gl.GL_PROJECTION);         //Projeksiyon matriksine geçip
            Gl.glLoadIdentity();                       //Projeksiyon matriksini LoadIdentity ile sıfırlıyorum
            Gl.glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); //Sonra da böyle bir projeksiyon görüntüsü, kamera kullandırıyorum.x sıfırdan bire, y sıfırdan bire, z eksi birden bire değişecek diye ilk değerleri atamış olduk

            /*Projeksiyon matriksini "Gl.glMatrixMode(Gl.GL_PROJECTION);" böyle doldurduktan sonra
             * onu hemen model matriksine dönüştürmek lazım aslında. Ya da drow(sanırım öyle dedi)
             * kısmını ona muhakkak çeviriyoruz. Projeksiyon matriksinde bırakmayın */
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
        }
Exemplo n.º 8
0
 private void buttonDondur9_Click(object sender, EventArgs e)
 {
     x = (x + 15) % 360;
     OpenGlControl.Refresh();
     y = (y + 50) % 360;
     OpenGlControl.Refresh();
     z = (z + 25) % 360;
     OpenGlControl.Refresh();
     w = (w + 5) % 360;
     OpenGlControl.Refresh();
     q = (q + 35) % 360;
     OpenGlControl.Refresh();
     r = (r + 120) % 360;
     OpenGlControl.Refresh();
     p = (p + 55) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 9
0
 private void buttonDondur8_Click(object sender, EventArgs e)
 {
     t = (t + 60) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 10
0
 private void buttonDondur7_Click(object sender, EventArgs e)
 {
     p = (p + 55) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 11
0
 private void buttonDondur6_Click(object sender, EventArgs e)
 {
     r = (r + 120) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 12
0
 private void buttonDondur5_Click(object sender, EventArgs e)
 {
     q = (q + 35) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 13
0
 private void buttonDondur2_Click(object sender, EventArgs e)
 {
     y = (y + 50) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 14
0
 private void buttonDondur1_Click(object sender, EventArgs e)
 {
     x = (x + 15) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 15
0
 private void buttonDondur3_Click(object sender, EventArgs e)
 {
     z = (z + 25) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 16
0
 private void MyKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.A)
     {
         x = (x - 55) % 360;
     }
     if (e.KeyCode == Keys.B)
     {
         x = (x + 35) % 360;
     }
     OpenGlControl.Refresh();
     if (e.KeyCode == Keys.C)
     {
         y = (y - 25) % 360;
     }
     if (e.KeyCode == Keys.D)
     {
         y = (y + 65) % 360;
     }
     OpenGlControl.Refresh();
     if (e.KeyCode == Keys.E)
     {
         z = (z - 25) % 360;
     }
     if (e.KeyCode == Keys.F)
     {
         z = (z + 75) % 360;
     }
     OpenGlControl.Refresh();
     if (e.KeyCode == Keys.G)
     {
         w = (w - 35) % 360;
     }
     if (e.KeyCode == Keys.H)
     {
         w = (w + 105) % 360;
     }
     OpenGlControl.Refresh();
     if (e.KeyCode == Keys.I)
     {
         q = (q - 65) % 360;
     }
     if (e.KeyCode == Keys.J)
     {
         q = (q + 15) % 360;
     }
     OpenGlControl.Refresh();
     if (e.KeyCode == Keys.K)
     {
         p = (p - 85) % 360;
     }
     if (e.KeyCode == Keys.L)
     {
         p = (p + 15) % 360;
     }
     OpenGlControl.Refresh();
     if (e.KeyCode == Keys.M)
     {
         r = (r - 55) % 360;
     }
     if (e.KeyCode == Keys.N)
     {
         r = (r + 35) % 360;
     }
     OpenGlControl.Refresh();
     if (e.KeyCode == Keys.F10)
     {
         this.Close();
     }
 }
Exemplo n.º 17
0
 private void buttonDondur4_Click(object sender, EventArgs e)
 {
     w = (w + 5) % 360;
     OpenGlControl.Refresh();
 }
Exemplo n.º 18
0
 public MainForm()
 {
     InitializeComponent();
     OpenGlControl.InitializeContexts();
     Utility.FPS.reset();
 }
Exemplo n.º 19
0
 void tileEditorController_OnRenderingComplete()
 {
     OpenGlControl.SwapBuffers();
 }