本文整理汇总了C#中GameStateManagement.InputState.IsNewGamePadButtonPress方法的典型用法代码示例。如果您正苦于以下问题:C# InputState.IsNewGamePadButtonPress方法的具体用法?C# InputState.IsNewGamePadButtonPress怎么用?C# InputState.IsNewGamePadButtonPress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameStateManagement.InputState
的用法示例。
在下文中一共展示了InputState.IsNewGamePadButtonPress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleGamePadInput
public override void HandleGamePadInput(InputState input)
{
if (input.GamePadWasConnected)
{
PlayerIndex player;
if (input.IsNewGamePadButtonPress(Buttons.Back, out player) || input.IsNewGamePadButtonPress(Buttons.B, out player))
{
OnCancel(player);
}
else if (input.IsNewGamePadButtonPress(Buttons.Start, out player) || input.IsNewGamePadButtonPress(Buttons.A, out player))
{
OnSelectEntry(selectedEntry, PlayerIndex.One);
}
else if (input.IsNewGamePadButtonPress(Buttons.LeftThumbstickUp, out player) || input.IsNewGamePadButtonPress(Buttons.DPadUp, out player))
{
if (selectedEntry > 0)
selectedEntry--;
}
else if (input.IsNewGamePadButtonPress(Buttons.LeftThumbstickDown, out player) || input.IsNewGamePadButtonPress(Buttons.DPadDown, out player))
{
if (selectedEntry < menuEntries.Count - 1)
selectedEntry++;
}
}
}
示例2: HandleInput
/// <summary>
/// Input helper method provided by GameScreen. Packages up the various /// input values for ease of use.
/// </summary>
/// <param name="input">The state of the gamepads</param>
public override void HandleInput(InputState input)
{
PlayerIndex player;
if (input == null)
throw new ArgumentNullException("input");
if (input.IsNewKeyPress(Keys.F12, out player))
{
if (!Windows.UI.ViewManagement.ApplicationView
.GetForCurrentView().IsFullScreen)
Windows.UI.ViewManagement.ApplicationView
.GetForCurrentView().TryEnterFullScreenMode();
else
Windows.UI.ViewManagement.ApplicationView
.GetForCurrentView().ExitFullScreenMode();
}
if (gameOver)
{
if (input.IsPauseGame())
{
FinishCurrentGame();
}
if (input.IsNewKeyPress(Keys.Space, out player)
|| input.IsNewKeyPress(Keys.Enter, out player))
{
FinishCurrentGame();
}
if (input.IsNewGamePadButtonPress(Buttons.A, out player)
|| input.IsNewGamePadButtonPress(Buttons.Start, out player))
{
FinishCurrentGame();
}
if (input.IsNewMouseButtonPress(MouseButtons.LeftButton,
out player))
{
FinishCurrentGame();
}
foreach (GestureSample gestureSample in input.Gestures)
{
if (gestureSample.GestureType == GestureType.Tap)
{
FinishCurrentGame();
}
}
return;
}
}