public void Poll(IInputState inputState) { GamePadState oldState = state; state = inputState.GamePadStateOf(PlayerIndex); ApplyKeyMap(ref state, inputState); foreach (var button in ButtonNames) { var oldDown = oldState.IsButtonDown(button); var newDown = state.IsButtonDown(button); if (oldDown != newDown) { if (newDown) { OnButtonPressed(button); } else { OnButtonReleased(button); } } } if (state.ThumbSticks.Left != oldState.ThumbSticks.Left) { LeftStickChanged?.Invoke(this, EventArgs.Empty); } if (state.ThumbSticks.Right != oldState.ThumbSticks.Right) { RightStickChanged?.Invoke(this, EventArgs.Empty); } }