예제 #1
0
 public StickState(XBoxController controller, StickType type)
 {
     _controller               = controller;
     _stickType                = type;
     _previosValue             = new Point(0, 0);
     _controller.StateChanged += _controller_StateChanged;
 }
        public static void MoveAndRelease(this ISwitchController controller, StickType stick, byte x, byte y, int duration, int wait = 0)
        {
            if (controller == null)
            {
                throw new ArgumentNullException(nameof(controller));
            }

            controller.MoveStick(stick, x, y);
            Thread.Sleep(duration);
            controller.ReleaseStick(stick);
            Thread.Sleep(wait);
        }
예제 #3
0
        public void ReleaseStick(StickType stick)
        {
            const byte Center = 128;

            MoveStick(stick, Center, Center);
        }
예제 #4
0
 public void MoveStick(StickType stick, byte x, byte y)
 {
     WriteSerialPort(new[] { (byte)ControlType.Stick, (byte)stick, x, y, });
 }