void handleCameraControls(GameTime gameTime) { int scrollWheelDelta = MouseStatus.ScrollwheelDelta; if (scrollWheelDelta > 0 /* && kstate.IsKeyDown(Keys.LeftControl)*/) { float zoom = (float)Math.Round(Camera.Scale * 10) * 10.0f + 10.0f; _mainForm.SetZoomComboText(zoom.ToString( ) + "%"); Camera.Scale = zoom / 100.0f; } if (scrollWheelDelta < 0 /* && kstate.IsKeyDown(Keys.LeftControl)*/) { float zoom = (float)Math.Round(Camera.Scale * 10) * 10.0f - 10.0f; if (zoom <= 0.0f) { return; } _mainForm.SetZoomComboText(zoom.ToString( ) + "%"); Camera.Scale = zoom / 100.0f; } //Camera movement float delta; if (KeyboardStatus.IsKeyDown(Keys.LeftShift)) { delta = Constants.Instance.CameraFastSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; } else { delta = Constants.Instance.CameraSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; } bool leftControlKeyNotPressed = KeyboardStatus.IsKeyUp(Keys.LeftControl); if (KeyboardStatus.IsKeyDown(Keys.W) && leftControlKeyNotPressed) { Camera.Position += (new Vector2(0, -delta)); } if (KeyboardStatus.IsKeyDown(Keys.S) && leftControlKeyNotPressed) { Camera.Position += (new Vector2(0, +delta)); } if (KeyboardStatus.IsKeyDown(Keys.A) && leftControlKeyNotPressed) { Camera.Position += (new Vector2(-delta, 0)); } if (KeyboardStatus.IsKeyDown(Keys.D) && leftControlKeyNotPressed) { Camera.Position += (new Vector2(+delta, 0)); } if (KeyboardStatus.IsKeyDown(Keys.Subtract)) { var zoom = (float)(Camera.Scale * 0.995); _mainForm.SetZoomComboText(textualRepresentationOfZoom(zoom)); Camera.Scale = zoom; } if (KeyboardStatus.IsKeyDown(Keys.Add)) { var zoom = (float)(Camera.Scale * 1.005); _mainForm.SetZoomComboText(textualRepresentationOfZoom(zoom)); Camera.Scale = zoom; } //get mouse world position considering the ScrollSpeed of the current layer Vector2 maincameraposition = Camera.Position; if (getLevel( ).ActiveLayer != null) { Camera.Position *= getLevel( ).ActiveLayer.ScrollSpeed; } MouseStatus.UpdateCamera(Camera); MouseStatus.WorldPosition = Vector2.Transform(MouseStatus.ScreenPosition, Matrix.Invert(Camera.Matrix)); MouseStatus.WorldPosition = MouseStatus.WorldPosition.Round( ); _mainForm.SetToolStripStatusLabel3( "Mouse: ({0}, {1})".FormatWith(MouseStatus.WorldPosition.X, MouseStatus.WorldPosition.Y)); Camera.Position = maincameraposition; }