private void joystickTest(VMulti vmulti) { double i = 0; bool running = true; while (running) { JoystickButtonState joyButtonState = new JoystickButtonState(); joyButtonState.A = false; joyButtonState.X = false; joyButtonState.Left = false; double x = Math.Sin(i); double y = Math.Cos(i); Console.WriteLine("x: " + x + " y: " + y); JoystickReport joystickReport = new JoystickReport(joyButtonState, x, y); Console.WriteLine("Update Joystick: " + vmulti.updateJoystick(joystickReport)); i += 0.1; System.Threading.Thread.Sleep(100); } }
public JoystickReport(JoystickButtonState buttonState, double joystickX, double joystickY) { this.buttonState = buttonState; if (joystickX > 1) { joystickX = 1.0; } else if (joystickX < -1) { joystickX = -1.0; } if (joystickY > 1) { joystickY = 1.0; } else if (joystickY < -1) { joystickY = -1.0; } this.joystickX = joystickX; this.joystickY = joystickY; }