Determines the state of a gamepads buttons
Beispiel #1
0
 public GamePadManager()
 {
     IsEnabled = true;
     CurrentState = new GamePadState[4];
     PreviousState = new GamePadState[4];
     CurrentButtonState = new GamePadButtonState[4];
     PreviousButtonState = new GamePadButtonState[4];
 }
Beispiel #2
0
 public void Update(GameTime gameTime)
 {
     for (var i = 0; i < 4; i++)
     {
         PreviousState[i] = CurrentState[i];
         CurrentState[i] = GamePad.GetState((PlayerIndex)i);
         PreviousButtonState[i] = CurrentButtonState[i];
         if (CurrentButtonState[i] == null) CurrentButtonState[i] = new GamePadButtonState();
         CurrentButtonState[i].Update(CurrentState[i]);
     }
 }