public void Go() { Xim.Input input = new Xim.Input(); Xim.Input blankInput = new Xim.Input(); Vector2 spot = new Vector2(deadzone,0); Dir direction = Dir.Down; double incVal = 500; while (!abort) { if (going) { if (circular) { spot.Rotate(Math.PI / 90); input.RightStickX = (short)(/*Math.Sign(spot.X) * 9600 +*/ (short)spot.X); input.RightStickY = (short)(/*Math.Sign(spot.Y) * 9600 +*/ (short)spot.Y); Xim.SendInput(ref input, 25); //Xim.SendInput(ref blankInput, 0); } else { switch (direction) { case Dir.Up: if (spot.Y < deadzone) { spot.Y = spot.Y + incVal; } if (spot.Y >= deadzone) { spot.Y = deadzone; direction = Dir.Right; } break; case Dir.Right: if (spot.X < deadzone) { spot.X = spot.X + incVal; } if (spot.X >= deadzone) { spot.X = deadzone; direction = Dir.Down; } break; case Dir.Down: if (spot.Y > -deadzone) { spot.Y = spot.Y - incVal; } if (spot.Y <= -deadzone) { spot.Y = -deadzone; direction = Dir.Left; } break; case Dir.Left: if (spot.X > -deadzone) { spot.X = spot.X - incVal; } if (spot.X <= -deadzone) { spot.X = -deadzone; direction = Dir.Up; } break; } input.RightStickX = (short)spot.X; input.RightStickY = (short)spot.Y; //input.LeftTrigger = (short)Xim.Stick.Max; Xim.SendInput(ref input, 30); //Xim.SendInput(ref blankInput, 0); } } else { spot.X = deadzone; spot.Y = 0; } } this.ximDyn.Disconnect(); this.connected = false; }