本文整理汇总了C#中InputHelper.GamePadCheckPressed方法的典型用法代码示例。如果您正苦于以下问题:C# InputHelper.GamePadCheckPressed方法的具体用法?C# InputHelper.GamePadCheckPressed怎么用?C# InputHelper.GamePadCheckPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputHelper
的用法示例。
在下文中一共展示了InputHelper.GamePadCheckPressed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(GameTime gameTime, InputHelper Input)
{
cursor = Input.ControllerInUse ? new Rectangle(0, 0, 0, 0) : new Rectangle(Input.MouseCheckPosition().X, Input.MouseCheckPosition().Y, 1, 1);
if (cursor.Intersects(resumeButton) || selectedButton == Buttons.Resume)
{
resumeColor.A = 200;
if (Input.MouseButtonCheckPressed(true) || Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.A))
{
Resume = true;
}
}
else resumeColor.A = 255;
if (cursor.Intersects(optionsButton) || selectedButton == Buttons.Options)
{
optionsColor.A = 200;
if (Input.MouseButtonCheckPressed(true) || Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.A))
{
Options = true;
}
}
else optionsColor.A = 255;
if (cursor.Intersects(quitButton) || selectedButton == Buttons.Quit)
{
quitColor.A = 200;
if (Input.MouseButtonCheckPressed(true) || Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.A))
{
Quit = true;
}
}
else quitColor.A = 255;
if (Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.LeftThumbstickDown))
{
if (selectedButton == Buttons.None)
selectedButton = Buttons.Resume;
else
selectedButton++;
if (selectedButton == Buttons.None)
selectedButton = Buttons.Resume;
}
if (Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.LeftThumbstickUp))
{
if (selectedButton == Buttons.None)
selectedButton = Buttons.Quit;
else if (selectedButton == Buttons.Resume)
selectedButton = Buttons.Quit;
else
selectedButton--;
}
}
示例2: Update
public void Update(GameTime gameTime, InputHelper Input)
{
//otherwise it would be possible that the cursor rectangle is still on a button eventhough the controller is in use
cursor = Input.ControllerInUse ? new Rectangle(0, 0, 0, 0) : new Rectangle(Input.MouseCheckPosition().X, Input.MouseCheckPosition().Y, 1, 1);
//if the cursor is over a button or the button is selected with a controller, the button will change color
if (cursor.Intersects(startButton) || selectedButton == Buttons.Start)
{
startColor.A = MouseOverAlpha;
if (Input.MouseButtonCheckPressed(true) || Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.A))
{
Start = true;
}
}
else startColor.A = StandardAlpha;
if (cursor.Intersects(optionsButton) || selectedButton == Buttons.Options)
{
optionsColor.A = 200;
if (Input.MouseButtonCheckPressed(true) || Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.A))
{
Options = true;
}
}
else optionsColor.A = 255;
if (cursor.Intersects(exitButton) || selectedButton == Buttons.ExitGame)
{
exitColor.A = 200;
if (Input.MouseButtonCheckPressed(true) || Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.A))
{
ExitGame = true;
}
}
else exitColor.A = 255;
//scrolling through menu with controller
if (Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.LeftThumbstickDown))
{
if (selectedButton == Buttons.None)
selectedButton = Buttons.Start;
else
selectedButton++;
if (selectedButton == Buttons.None)
selectedButton = Buttons.Start;
}
if (Input.GamePadCheckPressed(Microsoft.Xna.Framework.Input.Buttons.LeftThumbstickUp))
{
if (selectedButton == Buttons.None)
selectedButton = Buttons.ExitGame;
else if (selectedButton == Buttons.Start)
selectedButton = Buttons.ExitGame;
else
selectedButton--;
}
}