当前位置: 首页>>代码示例>>C#>>正文


C# InputHelper.MouseButtonCheckPressed方法代码示例

本文整理汇总了C#中InputHelper.MouseButtonCheckPressed方法的典型用法代码示例。如果您正苦于以下问题:C# InputHelper.MouseButtonCheckPressed方法的具体用法?C# InputHelper.MouseButtonCheckPressed怎么用?C# InputHelper.MouseButtonCheckPressed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputHelper的用法示例。


在下文中一共展示了InputHelper.MouseButtonCheckPressed方法的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--;
            }
        }
开发者ID:rubna,项目名称:MetroidClone,代码行数:54,代码来源:PauseMenu.cs

示例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--;
            }
        }
开发者ID:rubna,项目名称:MetroidClone,代码行数:57,代码来源:MainMenu.cs


注:本文中的InputHelper.MouseButtonCheckPressed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。