コード例 #1
0
ファイル: Program.cs プロジェクト: Hanh-Pham/WiiMoteMouse
        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);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Hanh-Pham/WiiMoteMouse
        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);
            }
        }