Determines the state of a gamepads buttons
Пример #1
0
 public GamePadManager()
 {
     IsEnabled = true;
     CurrentState = new GamePadState[4];
     PreviousState = new GamePadState[4];
     CurrentButtonState = new GamePadButtonState[4];
     PreviousButtonState = new GamePadButtonState[4];
 }
Пример #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]);
     }
 }