コード例 #1
0
 // Create joystick updated listener
 private void joystick_updated(object source, joystickEventArgs e)
 {
     if (theReferenceUsbDevice.isDeviceAttached)
     {
         double senseValue = 0;
         joySenseSlider.Dispatcher.Invoke(
             DispatcherPriority.Normal,
             (System.Threading.ThreadStart) delegate { senseValue = joySenseSlider.Value; }
             );
         theReferenceUsbDevice.run((sbyte)(e.X * senseValue), (sbyte)(e.Y * senseValue));
     }
 }
コード例 #2
0
 // Create joystick connect listener
 private void joystick_connected(object source, joystickEventArgs e)
 {
     if (connectedJoystick.isDeviceAttached)
     {
         enableJoyControls();
         Debug.WriteLine("Yay! Joystick currently attached.");
     }
     else
     {
         disableJoyControls();
         Debug.WriteLine("Ow! Joystick connection lost.");
     }
 }