This is all well and good, but we still can't get input from a joystick. So let's look at that now. First, we need to add three member variables for our joystick, just like we did for the mouse and keyboard. Here are the three new member variables we need to add to our
Joystick m_Joystick1; JoystickState m_Joy1StateCurrent; JoystickState m_Joy1StateLast;
As before, we have a variable to hold our device object (in this case, a
Joystick object), and two more variables to hold the joystick state for the current frame and for the previous frame.
Now, we need to add two lines at the bottom of our constructor to initialize the joystick state variables. As discussed earlier in this chapter, this prevents ...