Sorry if this is a basic question.
I am learning MonoGame and trying to connect my gamepad (Elecom JC-U4113SBK) which has XInput mode, but GamePad.GetState(PlayerIndex.One).IsConnected
always returns false
, so I can’t use the gamepad.
However, weird or not, I can connect my gamepad with XInput.Wrapper. So I think it is doing fine as a XInput gamepad…
Does MonoGame only detect Xbox 360 controller like this down below or should it detect all the XInput gamepads? Some advice on it is very much appreciated.
I could use XInput for input and MonoGame for the rest, but it doesn’t feel quite natural to me.
I am using MonoGame v3.6. Thank you!
If I remember correctly, Windows Project only supports XInput controllers.
You can create Cross Platform Desktop Project (also known as DesktopGL) which should work with most controllers, but usage is slightly different.
1 Like
Wow, my gamepad worked just fine on Cross Platform Desktop Project!
Although I am not sure why my gamepad didn’t work on Windows Project since it says XInput mode available (and I’m in that mode), at least I found the way to work around (maybe it is not really a “XInput Controller”…).
Anway, thank you very much for the information!
No problem, glad you got it working
Pressing the [Start] button on the controller while the Monogame project was running fixed the issue for me.
I had the same condition of the XBOX USB controller showing IsConnected = false (Monogame Cross Platform Desktop Project) and was also frustrated by the condition. In testing, while the game was running, I pressed the [Start] button on the gamepad and the gamepad showed IsConnected = true. Subsequent restarts of Visual Studio and the game did not require pressing the [Start] button.
The controller showed connected and responsive in Windows and inactive in the Monogame project prior to pressing [Start] button on the controller.
TESTING CODE:
connected = GamePad.GetState(PlayerIndex.One).IsConnected;
pressedBack = GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed;
padState = GamePad.GetState(PlayerIndex.One);
if (connected)
{
message = “Connected”;
}
else
{
message = “Not connected”;
}
if (pressedBack)
{
message = message + “\npressedBack”;
}