Game Development Reference
In-Depth Information
Figure 9.12
Xbox 360 controller.
The Xbox 360 controller has a few different types of controls. It has two control
sticks on the front. We'll want to be able to get a value from -1 to 1 on the
X and Y axis to determine where the player moves the control stick. The D-pad
supports basic left, right, up, and down commands. The rest of the controls on
the face of the controller are made from simple buttons: Back, Start, A, B, X, and
Y. These are quite simple with only two states, pressed and not pressed, which
can be represented by a boolean variable. On the top of the controller are four
shoulder buttons, the buttons nearest the face of the controller are simple but-
tons, but the back two buttons are triggers. The triggers are special because they
are not digital on/off buttons; they have a range of values from 0 to 1, depending
on how hard they are pressed. All these controls together make quite a compli-
cated gamepad, and a number of classes will be needed to describe the different
functionality of each type of control.
To begin, a new game test state needs to be made. Call this state
InputTestState and make it the default loaded state in the normal way. The
gamepad wrappings exist in the SDL section of the Tao Framework; this means
another reference needs to be added—Tao framework SDL Binding for .NET (if
you don't have this reference then select the Browse tab, navigate to the
 
Search WWH ::




Custom Search