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


C# InputDevice.IsPressed方法代码示例

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


在下文中一共展示了InputDevice.IsPressed方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            if (input.IsPressed(Buttons.Start) || input.IsPressed(Buttons.B))
                TransitionTo(parent);

            if (input.IsPressed(Buttons.A) && curr_option == 3)
                Application.GetInstance().Exit();

            base.OnActive(elapsed, input);
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:10,代码来源:mainmenu.cs

示例2: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            editor.Update(elapsed);

            if (input.IsPressed(Buttons.Start))
                screenmanager.FadeIn(menu_screen);
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:7,代码来源:editorscreen.cs

示例3: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            if (input.IsPressed(Buttons.B))
            {
                TransitionTo(parent);
            }

            base.OnActive(elapsed, input);
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:9,代码来源:help.cs

示例4: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            if (input.IsPressed(Buttons.B))
                TransitionTo(parent);

            if (input.IsPressed(Buttons.A) && curr_option == 0)
            {
                camera_switch.SetValue(default_free_camera);
                debug_switch.SetValue(default_debug_view);
            }

            if (input.IsPressed(Buttons.A) && curr_option == camera_switch.index)
                screenmanager.SetActive(camera_switch);

            if (input.IsPressed(Buttons.A) && curr_option == debug_switch.index)
                screenmanager.SetActive(debug_switch);

            base.OnActive(elapsed, input);
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:19,代码来源:options.cs

示例5: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            float input_x, input_y;
            input_x = input.LeftThumbStick.X;
            input_y = input.LeftThumbStick.Y;
            if (Math.Abs(input_x) + Math.Abs(input_y) < Math.Abs(input.RightThumbStick.X) + Math.Abs(input.RightThumbStick.Y))
            {
                input_x = input.RightThumbStick.X;
                input_y = input.RightThumbStick.Y;
            }

            if (input_y > Menu.epsilon)
                new_value = true;
            if (input_y < -Menu.epsilon)
                new_value = false;
            if (input_x > Menu.epsilon)
                new_value = true;
            if (input_x < -Menu.epsilon)
                new_value = false;

            if (input.IsPressed(Buttons.B)) // cancel
            {
                screenmanager.SetActive(parent);
                new_value = value;
            }

            if (input.IsPressed(Buttons.A)) // apply
            {
                screenmanager.SetActive(parent);

                if (new_value != value)
                {
                    value = new_value;
                    action(value);
                }
            }
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:37,代码来源:switch.cs

示例6: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            game.Update(elapsed);

            /*
            if (input.IsPressed(Buttons.LeftShoulder))
            {
                game.character.IncreaseSize();
                ParticleManager particlemanager = ParticleManager.GetInstance();
                particlemanager.Explode(game.character.position, 3);
            }

            if (input.IsPressed(Buttons.RightShoulder))
            {
                game.character.DecreaseSize();
                ParticleManager particlemanager = ParticleManager.GetInstance();
                particlemanager.Explode(game.character.position, 3);
            }
            */

            if (input.IsPressed(Buttons.Start) || input.IsPressed(Buttons.Back))
                screenmanager.FadeIn(menu_screen);

            time += (float)elapsed;
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:25,代码来源:gamescreen.cs

示例7: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            float input_x, input_y;
            input_x = input.LeftThumbStick.X;
            input_y = input.LeftThumbStick.Y;
            if (Math.Abs(input_x) + Math.Abs(input_y) < Math.Abs(input.RightThumbStick.X) + Math.Abs(input.RightThumbStick.Y))
            {
                input_x = input.RightThumbStick.X;
                input_y = input.RightThumbStick.Y;
            }

            new_value += (float)(input_y * elapsed);
            new_value += (float)(input_x * elapsed);
            new_value = MathHelper.Clamp(new_value, 0, 1);

            if (input.IsPressed(Buttons.B)) // cancel
            {
                screenmanager.SetActive(parent);
                new_value = value;
                action(value);
            }

            if (input.IsPressed(Buttons.A)) // apply
            {
                screenmanager.SetActive(parent);
                value = new_value;
                action(value);
            }

            action(new_value);
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:31,代码来源:slider.cs

示例8: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            float curr_input = Math.Abs(input.LeftThumbStick.Y) > Math.Abs(input.RightThumbStick.Y) ? input.LeftThumbStick.Y : input.RightThumbStick.Y;
            if (Math.Abs(curr_input) > epsilon)
                time_1 += (float)elapsed;
            else
                time_1 = 0;

            if (curr_input > epsilon && prev_direction > epsilon
             || curr_input < -epsilon && prev_direction < -epsilon)
                time_2 += (float)elapsed;
            else
                time_2 = 0;

            if ((time_1 > switch_delay && time_2 > scroll_delay) || (Math.Abs(prev_direction) < epsilon && Math.Abs(curr_input) > epsilon))
            {
                if (curr_input > epsilon)
                    curr_option--;
                if (curr_input < -epsilon)
                    curr_option++;

                if (curr_option < 0)
                    curr_option = options.Length - 1;

                curr_option %= options.Length;
                time_1 = 0;
            }

            if (input.IsPressed(Buttons.A))
            {
                TransitionTo(options[curr_option].screen);
            }

            prev_direction = curr_input;
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:35,代码来源:menu.cs

示例9: OnActive

 public override void OnActive(double elapsed, InputDevice input)
 {
     if (input.IsPressed(Buttons.A) || input.IsPressed(Buttons.B) || input.IsPressed(Buttons.Start))
     {
         TransitionTo(parent);
     }
 }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:7,代码来源:title.cs


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