I want to use a XBOX 360 Controller to play sounds if the "A" Button is pressed. In my Code Snippet I've used a while loop to check if the Button is pressed. Are there any Event Handlers I can use or different solutions (It's not for Game Development)?
while (b == false)
{
GamePadState currentState2 = GamePad.GetState(PlayerIndex.One);
if (currentState2.IsConnected
&& currentState2.Buttons.A
== Microsoft.Xna.Framework.Input.ButtonState.Pressed)
{
play1stTrack();
isButtonApressed = true;
}
}