Ejemplo n.º 1
0
 private void glControl1_Paint(object sender, PaintEventArgs e)
 {
     //Update Image
     Draw.Render();
     glControl1.SwapBuffers();
 }
Ejemplo n.º 2
0
 private void glControl1_Resize(object sender, EventArgs e)
 {
     //Updates the image according to to updated window parameters
     Draw.UpdateImage(Width, Height);
 }
Ejemplo n.º 3
0
        private void glControl1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {//Keyboard control
            base.OnKeyPress(e);

            if (e.KeyChar == 27)
            {
                //Escape
                this.Close();
            }

            switch (e.KeyChar.ToString().ToLower()[0])
            {
            case 'w':    //Forward
                Main.cam.Move(0f, 0.1f, 0f);
                Draw.UpdateImage(Width, Height);
                PosData();
                break;

            case 'a':    //Left
                Main.cam.Move(-0.1f, 0f, 0f);
                Draw.UpdateImage(Width, Height);
                PosData();
                break;

            case 's':    //Backward
                Main.cam.Move(0f, -0.1f, 0f);
                Draw.UpdateImage(Width, Height);
                PosData();
                break;

            case 'd':    //Right
                Main.cam.Move(0.1f, 0f, 0f);
                Draw.UpdateImage(Width, Height);
                PosData();
                break;

            case 'e':    //Up
                Main.cam.Move(0f, 0f, 0.1f);
                Draw.UpdateImage(Width, Height);
                PosData();
                break;

            case 'q':    //Down
                Main.cam.Move(0f, 0f, -0.1f);
                Draw.UpdateImage(Width, Height);
                PosData();
                break;

            case 'u':    //Zoom In
                if (zo)
                {
                    Main.cam.Zoom        -= 40;
                    Main.cam.Speed       /= 3;
                    Main.cam.Sensitivity /= 3;
                    zo = false;
                }
                Draw.UpdateImage(Width, Height);
                break;

            case 'i':    //Zoom Out
                if (!zo)
                {
                    Main.cam.Zoom        += 40;
                    Main.cam.Speed       *= 3;
                    Main.cam.Sensitivity *= 3;
                    zo = true;
                }
                Draw.UpdateImage(Width, Height);
                break;

            case 'j':    //Previous Iteration
                LastIt();
                break;

            case 'k':    //Next Iteration
                NextIt();
                break;

            case 'm':    //Mini Map
                if (Main.MiniMap)
                {
                    Main.MiniMap = false;
                    Main.Map     = Main.FEmpty.hollow().toDisplay();
                }
                else
                {
                    Main.MiniMap = true;
                }
                break;
            }
        }