This project is read-only.


Jul 30, 2011 at 5:01 PM
Edited Jul 31, 2011 at 1:04 PM

I can not get gamepad arrows state, i use this code in update method and put a breakpoint in DoSomething and it never gets called, I also use buttonPressed event to get buttons state which works, but I could not manage to get arrows state, what should I do:

if(input.GetGamePad(ExtendedPlayerIndex.Five).GetState().DPad.Up == ButtonState.Pressed)
Aug 9, 2011 at 10:43 AM

Does your game pad report its DPad as individual buttons or as a PoV hat?

The only DirectInput game pad I could test with was a Thrustmaster Dual Analog Pro, where I don't remember having any issues. I'll check again if that specified way of querying the DPad might be messed up or something.

Aug 9, 2011 at 11:42 PM
Edited Aug 9, 2011 at 11:44 PM

I manged to get it working like this, but I do not know why does it see its DPad as a ThumbStick, code and gamepad image below: 

if(input.GetGamePad(ExtendedPlayerIndex.Five).GetState().ThumbSticks.Left.Y > 0)



Aug 10, 2011 at 8:29 AM

That would be DirectInput. There are 4 different kinds of input objects: buttons (on/off), sliders (analogous 0.0 .. 1.0), axes (analogous -1.0 .. +1.0) and PoV hats (direction in degrees). A game pad is free to report its hardware as any of those.

My guess is that this game pad reports the directional pad as two analogous axes in order to work with as many games as possible (since a PoV hat is typically used for looking around instead of moving the character).

Nuclex.Input could theoretically map analogous axes to the DPad for the DirectInput -> XNA GamePadState translation, but I think that would be counter-productive (lots of game pads with an actual analogous thumb stick ending up with a digital DPad instead).

Aug 10, 2011 at 8:44 AM

Thank you for the explanation.