locked
Capturing input from a Joystick/Gamepad

    Question

  • Hi there,

    I'm a Java programmer starting a new project using C# to capture user input from a USB gamepad or joystick in order to control a camera (e.g. pan it, zoom in etc.) as part of a wider application. I've done no C# before, but I do have a solid understanding of programming in general and have done a reasonable amount of VBA in the past.

    I'm trying to figure out where I should start. I get the impression from reading this forum that this is probably the right place for this question - apologies if I've got that wrong - and that what I need to use is XInput (which replaces DirectInput which is part of DirectX ??). Am I correct here?

    Will the XInput API allow me to control any joystick or gamepad I plug into a USB port, or does the specifics of getting the input from it vary by model?

    Any pointers to relevant websites would be welcome, as would any pointers about what joystick/gamepad to use. The MS Common Controller for XBox 360 and PC looks like a good starting point to me.

    Thanks very much in advance,

    Rob

    Tuesday, March 06, 2007 4:48 PM

Answers

  • If you're a beginner, XNA Game Studio Express is probably an excellent starting point.  Tons of built-in tutorials, plus lots of additoinal help at http://creators.xna.com.

     

    Tuesday, March 06, 2007 8:45 PM

All replies

  • The best place to start is to look at the DirectX DirectInput sample for C#.

    You have to have the SDK installed anyway - so open the browser and look for the DirectInput samples.

    The project is very simple to read and implement in C#.

    Just curious - what kind of Joystick to you got?

    Tuesday, March 06, 2007 6:04 PM
  • Thanks, I'll check it out.

    Do you mean that I need to have the DirectX SDK installed?

    Don't have a joystick yet. My first job is to decide which one to buy.

    Thanks,

    Rob

    Tuesday, March 06, 2007 6:59 PM
  • If you're a beginner, XNA Game Studio Express is probably an excellent starting point.  Tons of built-in tutorials, plus lots of additoinal help at http://creators.xna.com.

     

    Tuesday, March 06, 2007 8:45 PM
  • About the Joystick - sincerely - If you have little cash - go with a high end one.

    I know it sounds weird but in the long run it will save you money.

    If you count the difference in fast food Value-Meals it ain't that bad.

    If you get a Saitek X52 (ONLY !!! if you need two consoles) beware of a problem I discovered with the Mode button (posted in this forum).

    To be able to read it you MUST keep the Joystick Properties window open at all times ( Control Panel - Game Controler).

    Weird ... could not find explanation - is it a DirectX problem or an OS problem or a Saitek problem ...

    Wednesday, March 07, 2007 2:41 PM