Whenever I press a button with my controller, the e.JoystickId that gets passed in when subscribing to JoystickButtonPressed is always 0. That is fine, however, if I call Joystick.IsConnected(0) it will always return false, as if the Joystick isn't plugged in. I noticed this because Joystick.IsButtonPressed() was always returning false for me whenever I would pass in the JoystickId along with the button that was just pressed. Am I doing something wrong or is this a known issue?
Example:
// My event handler
private void OnJoystickButtonPressed(object sender, JoystickButtonEventArgs e)
{
_joystickId = e.JoystickId; // This always ends up being 0 for me. But the event does fire whenever I press a button, so it's not like my joystick isn't detected
_joystickButtonEvents = true;
_pushedButtons.Add(e.Button);
}
// This gets called every frame update until all button events are dequeued
private void CheckButtonState()
{
foreach (uint button in _pushedButtons)
{
if (Joystick.IsConnected(_joystickId)) // This always returns false. I even tried all combinations (0-7) and it always returned false
{
if (Joystick.IsButtonPressed(_joystickId, button)) // This also always returns false but will never make it here since it doesn't get past the first check to see if the joystick is connected.
{
PerformButtonAction(button);
}
}
}
}