Last updated
Was this helpful?
Last updated
Was this helpful?
The Xbox360GamePad class represents the current state of a physical game pad. The Xbox360GamePad can provide information about its buttons and DPad with ButtonPushed, ButtonDown, and ButtonReleased methods. You can also get information about the analog sticks using the references. Information about the trigger buttons can be accessed through the references. The exposes an array of Xbox360GamePads. There are always 4 elements in this array regardless of the number of game pads connected.
The name Xbox360GamePad exists for historical reasons - XNA originally only exposed support for Xbox36 controllers. Modern versions of FlatRedBall provide support for a variety of hardware including:
Xbox360 and Xbox One controllers
Switch Pro controllers
USB Gamecube controllers
Playstation DualShock
General PC controllers
The Xbox360GamePad class reports whether a button was pushed the last frame, is currently down, or was released. The following code moves a to the right one unit when the A button is pressed and moves a to the left when the B button is released:
The following code reports the number of game pads connected at a given time:
The Xbox360GamePad provides two analog sticks:
LeftStick
RightStick
The following code sets the vibration on the game pad:
The Xbox360GamePad name orignally comes from the fact that XNA supported Xbox 360 controllers. Despite its name, the Xbo360GamePad class can be used on most FlatRedBall platforms. As of the time of this writing, the following platforms and hardware are supported.
Desktop GL: Xbox 360 controllers, Xbox One controllers, Switch Pro controllers, USB Gamecube controllers, PlayStation DualShock, Generic PC controllers
Desktop XNA: Xbox 360 controllers, Xbox One controllers
Android: Bluetooth and wired controllers
iOS: Untested
Each property provides information about the matching hardware analog stick. For more information on using the analog stick property, see the page.
See the .
The Xbox360GamePads which are part of the are automatically updated every frame by the engine. This information is not buffered, therefore very rapid button presses may not be ready by the controller.