Example #1
0
        private void HandleMouseInput(MouseState mouseState)
        {
            int x = (mouseState.X - (int)_gameBoardOrigin.X) / GamePiece.PieceWidth;
            int y = (mouseState.Y - (int)_gameBoardOrigin.Y) / GamePiece.PieceHeight;

            if (_gameBoard.PieceIsWithinGameBounds(x, y))
            {
                bool isAClickInput = mouseState.RightButton == ButtonState.Pressed || mouseState.LeftButton == ButtonState.Pressed;
                if (isAClickInput)
                {
                    bool rotateClockwise = mouseState.RightButton == ButtonState.Pressed;
                    _gameBoard.AddRotatingPiece(x, y, _gameBoard.GetPieceType(x, y), rotateClockwise);
                    _gameBoard.RotatePiece(x, y, rotateClockwise);
                    _inputTimer.Reset();
                }
            }
        }