Export (0) Print
Expand All

Desktop Joystick Sample

Microsoft Robotics

Glossary Item Box

DSS Interop Samples: Game ControllerXInput Controller Sample

VPL User Interface Services: Desktop Joystick

Microsoft Robotics Developer StudioSend feedback on this topic

Desktop Joystick Sample

The Desktop Joystick service provides the capabilities of a joystick in a Windows Form on the users desktop.

This sample is provided in the C# language. You can find the project files for this sample at the following location under the Microsoft Robotics Developer Studio installation folder:

Sample location
Samples\UX\JoystickForm

Contents:

Prerequisites

This sample requires no special hardware or software.

Using the Desktop Joystick service

The Desktop Joystick service provides the capabilities of a joystick in a Windows Form on the user's desktop. The service can be used in any scenario where the GameController service would be used..

This service implements the GameController service contract, and can be used in manifests as a partner service where the GameController service might otherwise be used. For example, the SimpleDashboard service uses the GameController service as a partner. If a physical joystick is not available, or if it is desirable to have a desktop view of the joystick input, then the Desktop Joystick service can be used as a partner.

DesktopJoystick

The large "trackball" simulates the joystick. You can drag on it with the left mouse button and the cross-hairs will move to show you the current location. When you release the mouse button the trackball will return to the center position. The X and Y values update to show the current position of the trackball. Note that the X and Y values range from -1000 to +1000 to be compatible with the GameController service.

In addition to the trackball, you can use the following keys on the keyboard: A = Left, D = Right, W = Forward, S = Backward. While you hold down one of these keys the trackball will move in the corresponding direction. When you release the key the trackball will return to the center position.

Several buttons are provided on the form as well. These are similar to a numeric keypad, but the interpretation is up to the application.

The Sticky Buttons checkbox makes the buttons stay depressed when you click on them. You must click on a button a second time to release it.

Other services can subscribe for notifications from the DesktopJoystick and will receive UpdateAxes and UpdateButtons messages, as well as the usual Replace. The UpdatePovHats and UpdateSliders notification messages (defined in the GameController contract) will never be generated by the DesktopJoystick.

Summary

This overview explains

DSS Interop Samples: Game ControllerXInput Controller Sample

VPL User Interface Services: Desktop Joystick

 

 

© 2012 Microsoft Corporation. All Rights Reserved.

Show:
© 2014 Microsoft