O'Reilly logo

3D Game Development with Microsoft Silverlight 3 Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—using the steering wheel in the game loop

Now, it is time to create a simple game loop for our XBAP WPF application and to make the necessary changes to it in order to use our new joystick manager. This time, we will use it to read values from the steering wheel:

  1. Stay in the 3DInvadersXBAP project.
  2. Open Page1.xaml.cs.
  3. Add the following private variables in the public partial class Page1 : Page, to hold an instance of the Joystick class and the last time a frame finished its rendering:
    // Holds the time when the method finished rendering a frame
    private DateTime _LastTick;
    // The instance of the Joystick class to access the wrapper
    private Joystick _joystick;
    
  4. Add the following lines of code before the end of the Page constructor:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required