Exemplo n.º 1
0
        private void openGLView_MouseMove(object sender, MouseEventArgs e)
        {
            if (_wasScrolled)
            {
                _wasScrolled = false;
                return;
            }

            if (_scrolling)
            {
                int dx = e.X - _mousePos.X;
                int dy = e.Y - _mousePos.Y;

                GameGraphics.OffsetX(-dx * 0.05f);
                GameGraphics.OffsetY(dy * 0.05f);                 //opengl uses different coordinate system

                _wasScrolled    = true;
                Cursor.Position = mapView.PointToScreen(_mousePos);
            }

            if (e.Button == MouseButtons.Left)
            {
                if (!_selecting)
                {
                    //_selectionStart = GameGraphics.TranslateMousePosition(e.Location);
                    //_selecting = true;
                }
                else
                {
                    _selectionEnd = e.Location;
                }
            }
        }
Exemplo n.º 2
0
 private void openGLView_KeyDown(object sender, KeyEventArgs e)
 {
     InfoLog.WriteInfo(e.KeyCode.ToString());
     if (e.KeyCode == Keys.Z)
     {
         Settings.Default.UseSafeRendering = !Settings.Default.UseSafeRendering;
     }
     else if (e.KeyCode == Keys.Q)
     {
         GameGraphics.Zoom(-1);
     }
     else if (e.KeyCode == Keys.E)
     {
         GameGraphics.Zoom(1);
     }
     else if (e.KeyCode == Keys.A)
     {
         GameGraphics.OffsetX(-Settings.Default.ScrollingSpeed);
     }
     else if (e.KeyCode == Keys.D)
     {
         GameGraphics.OffsetX(Settings.Default.ScrollingSpeed);
     }
     else if (e.KeyCode == Keys.W)
     {
         GameGraphics.OffsetY(Settings.Default.ScrollingSpeed);
     }
     else if (e.KeyCode == Keys.S)
     {
         GameGraphics.OffsetY(-Settings.Default.ScrollingSpeed);
     }
     else if (e.KeyCode == Keys.X)
     {
         _gameLogic.DeployMCV();
     }
     else if (e.KeyCode == Keys.U)
     {
         AudioEngine.Instance.Sound.PlayMisc(MiscSoundType.ComeToPappa);
     }
 }