internal static bool GetButtonState(GamePadState gamePadState, int gamePad, XboxInputButton button) { ButtonState currentState = ButtonState.Released; if (button == XboxInputButton.Xbox) { currentState = gamePadState.Buttons.Guide; } else if (button == XboxInputButton.Menu) { currentState = gamePadState.Buttons.Start; } else if (button == XboxInputButton.Home) { currentState = gamePadState.Buttons.Back; } else if (button == XboxInputButton.A) { currentState = gamePadState.Buttons.A; } else if (button == XboxInputButton.B) { currentState = gamePadState.Buttons.B; } else if (button == XboxInputButton.X) { currentState = gamePadState.Buttons.X; } else if (button == XboxInputButton.Y) { currentState = gamePadState.Buttons.Y; } else if (button == XboxInputButton.LeftBumper) { currentState = gamePadState.Buttons.LeftShoulder; } else if (button == XboxInputButton.RightBumper) { currentState = gamePadState.Buttons.RightShoulder; } else if (button == XboxInputButton.LeftStickIn) { currentState = gamePadState.Buttons.LeftStick; } else if (button == XboxInputButton.RightStickIn) { currentState = gamePadState.Buttons.RightStick; } else if (button == XboxInputButton.DpadUp) { currentState = gamePadState.DPad.Up; } else if (button == XboxInputButton.DpadDown) { currentState = gamePadState.DPad.Down; } else if (button == XboxInputButton.DpadLeft) { currentState = gamePadState.DPad.Left; } else if (button == XboxInputButton.DpadRight) { currentState = gamePadState.DPad.Right; } else if (button == XboxInputButton.LeftTrigger) { currentState = gamePadState.Triggers.Left > TRIGGER_DEAD_SPACE ? ButtonState.Pressed : ButtonState.Released; } else if (button == XboxInputButton.RightTrigger) { currentState = gamePadState.Triggers.Right > TRIGGER_DEAD_SPACE ? ButtonState.Pressed : ButtonState.Released; } return(currentState == ButtonState.Pressed); }
internal static bool GetButton(int gamePad, XboxInputButton button) { return(GetButtonState(instance.controllers[gamePad], gamePad, button)); }