I'm using MonoGame and SDL2. I'm having a strange problem with the Gamepad. When I disconnect it during the game, before the disconnected event fires, the left and right triggers return values as if they were half-pressed.
The following code demonstrates the problem. Left or right trigger isn't really being pressed at all.
(From this source file https://github.com/dineshkummarc/MonoGame-2.5.1.0-0/blob/master/MonoGame.Framework/Desktop/Input/GamePad.cs)
GamePadTriggers triggers = new GamePadTriggers(c.LeftTrigger.ReadFloat(device), c.RightTrigger.ReadFloat(device));
// The following is debug code added by me
if (c.LeftTrigger.ReadFloat(device) > 0) {
var rawSDLvalue= SDL.SDL_GameControllerGetAxis(device, (SDL.SDL_GameControllerAxis)(c.LeftTrigger.ID));
Console.WriteLine("DURRURRRURRRRRRRR WHY IS IT NOT ZERO, IT SHOULD BE????" + c.LeftTrigger.ReadFloat(device) +" RAW "+rawSDLvalue);
}
Is there any real solution to this? Since the disconnected event fires afterward, I have no means to distinguish whether the triggers were really pressed or not. Any ideas? Are other SDL2 users experiencing this too?