Exemple #1
0
        private static void MoveMouse(NunchukState nunchukState)
        {
            var position  = MouseOperations.GetCursorPosition();
            var joyStickX = nunchukState.Joystick.X;
            var joyStickY = nunchukState.Joystick.Y;

            if (joyStickY > 0.05 || joyStickY < -0.05 || joyStickX > 0.05 || joyStickX < -0.05)
            {
                var posX = joyStickX > 0.1 ? position.X + _moveSpeed : position.X - _moveSpeed;
                var posY = joyStickY > 0.1 ? position.Y - _moveSpeed : position.Y + _moveSpeed;
                MouseOperations.SetCursorPosition(posX, posY);
            }
        }
Exemple #2
0
        private static void MoveMouse(ButtonState buttonState)
        {
            var position = MouseOperations.GetCursorPosition();

            if (buttonState.Left)
            {
                MouseOperations.SetCursorPosition(position.X - _moveSpeed, position.Y);
            }

            if (buttonState.Right)
            {
                MouseOperations.SetCursorPosition(position.X + _moveSpeed, position.Y);
            }

            if (buttonState.Up)
            {
                MouseOperations.SetCursorPosition(position.X, position.Y - _moveSpeed);
            }

            if (buttonState.Down)
            {
                MouseOperations.SetCursorPosition(position.X, position.Y + _moveSpeed);
            }
        }