# Using XBOX controllers on PC for an XNA game

Does anybody know how to do this? I have been trying to figure this out with no luck.

• Wired or wireless? – Chris Simmons Dec 9 '10 at 5:26
• multiple wireless – Egon Dec 13 '10 at 9:51

This? I think the GamePad stuff works on Windows last time I tried it.

It should work pretty easy. I'm using an xbox 360 controller plugged into my windows machine as my main gaming controller, and to make an XNA project use it all I had to do was:

GamePadState gamepadState = GamePad.GetState(PlayerIndex.One);

float movement = gamePadState.ThumbSticks.Left.X * MoveStickScale;

if (Math.Abs(movement) < 0.5f)
movement = 0.0f;
//do something
}
//do something else
}


and so on. Have you tried testing that the 360 controller works properly with your machine? Like, with other programs/games? Maybe you've just got a driver problem, but I think windows vista and 7 have the 360 drivers by default. (I'm using XP, had to install them)

Try looking at these code samples: http://create.msdn.com/en-US/education/catalog/sample/platformer

http://create.msdn.com/en-US/education/catalog/sample/input_sequence_sample

You need the "XBox Controller For Windows". As far as I know the controller itself is the same, however, you get an adapter that can be used with any XBox controller device. Either that, or the device just ships with the driver CD.

I would go with Zaphod42's advice (just plug the thing in if it's a standard USB device); and if that doesn't work order one online.

Not 100% sure because I don't own an XBox.

You need one of the Microsoft Xbox 360 Wireless Gaming Receivers for the wireless pads.