This project is read-only.

How to know if the gamepad is connected in Xen?

Jun 1, 2009 at 3:52 AM

in XNA it would be:

GamePad.GetState( PlayerIndex.**** ).IsConnected;

Should I still use that, or would it be best to have it in the Xen.Input.State.InputState class?

I'd like to be able to pop the pause menu if my gamepad is disconnected.


Your input system is really nice, almost the same thing as I use at work. The only thing you don't have are input context (menu, in game, vehicule, ...), different bindings for different situations. It's not something that's really needed for all games, but it can be nice, especially with PC games.

Jun 1, 2009 at 4:38 AM

The way you mention, using XNA would be the best way. It's not something I directly expose. Although you can also use UpdateState to get cached versions of the GamePadState (because GamePad.GetState is sloooow!)

Thanks for the positive comments :-) The input system is actually one of the oldest parts of Xen, and (honestly) I don't like it that much, although I've improved it a lot since the early releases :D but it would be difficult to change things now without breaking things.

Jun 1, 2009 at 6:20 AM

Did you mean :

GamePadState gps;
state.GetGamePadState( 0, gps );



Jun 1, 2009 at 9:51 AM

That's the one.
Note, on the PC, if the gamepad for player 1 is connected at startup, the default is to use the gamepad instead of MouseKeyboard.