Now, it is time to invite your project manager to control the game using the gamepad in a Silverlight application:
1. Stay in the
SilverlightInvaders2DVector
project.2. Build and run the solution. Click on the button and move the ship to the aliens, using the right mini stick. You will be able to move and stop the ship with great accuracy, using the gamepad, as shown in the following picture:
3. Now, use the gamepad's four action buttons to control the ship's movement.
Many Silverlight developers had told your project manager that it was impossible to use a gamepad to control a Silverlight application. For this reason, he is delighted to see that the Silverlight games you are creating can use a gamepad.
We did not have to change a single line of code. Firstly, we had to take the input from a keyboard, taking into account that many keys could be pressed during the time taken to render one frame. Then, mapping the gaming input device to keys...