private void HandleInput() { var mouseState = Mouse.GetState(); var anyWindowHasFocus = _maskCreationWindow.WindowHasFocus || _mazeConfigWindow.WindowHasFocus; if (mouseState.LeftButton == ButtonState.Pressed && !anyWindowHasFocus) { // Either starting or continuing a drag if (_mousePositionLastFrame == null) { _mousePositionLastFrame = mouseState.Position; } var moveAmount = mouseState.Position - _mousePositionLastFrame.Value; _mazeRenderer.MoveRenderedMaze(moveAmount); _mousePositionLastFrame = mouseState.Position; } else { // No longer panning _mousePositionLastFrame = null; } var scrollWheelChange = mouseState.ScrollWheelValue - _scrollWheelLastFrame; _scrollWheelLastFrame = mouseState.ScrollWheelValue; _mazeRenderer.ScaleRenderedMaze(scrollWheelChange); if (Keyboard.GetState().IsKeyDown(Keys.F1)) { _f1WasDown = true; } else if (_f1WasDown) { _mazeConfigWindow.ToggleDemoWindow(); _f1WasDown = false; } if (Keyboard.GetState().IsKeyDown(Keys.F2)) { _f2WasDown = true; } else if (_f2WasDown) { _mazeConfigWindow.ToggleMetricsWindow(); _f2WasDown = false; } }