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


C# KeyboardState.IsPressed方法代码示例

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


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

示例1: Update

        public override void Update()
        {
            turbo = !turbo;
            if (keyboard.Acquire().IsSuccess)
            {
                state = keyboard.GetCurrentState();
                DATA = 0;

                if (state.IsPressed(KeyA))
                    DATA |= 1;

                if (state.IsPressed(KeyB))
                    DATA |= 2;

                if (state.IsPressed(KeyTurboA) && turbo)
                    DATA |= 1;

                if (state.IsPressed(KeyTurboB) && turbo)
                    DATA |= 2;

                if (state.IsPressed(KeySelect))
                    DATA |= 4;

                if (state.IsPressed(KeyStart))
                    DATA |= 8;

                if (state.IsPressed(KeyUp))
                    DATA |= 0x10;

                if (state.IsPressed(KeyDown))
                    DATA |= 0x20;

                if (state.IsPressed(KeyLeft))
                    DATA |= 0x40;

                if (state.IsPressed(KeyRight))
                    DATA |= 0x80;
            }
        }
开发者ID:ywjno,项目名称:mynes-code,代码行数:39,代码来源:NesJoypadPcKeyboardConnection.cs

示例2: Update

        public override void Update()
        {
            if (keyboard.Acquire().IsSuccess)
            {
                state = keyboard.GetCurrentState();

                data4016 = 0;

                if (state.IsPressed(CreditServiceButton))
                    data4016 |= 0x04;
                if (state.IsPressed(DIPSwitch1))
                    data4016 |= 0x08;
                if (state.IsPressed(DIPSwitch2))
                    data4016 |= 0x10;
                if (state.IsPressed(CreditLeftCoinSlot))
                    leftCoin = true;
                if (leftCoin)
                    data4016 |= 0x20;
                if (state.IsPressed(CreditRightCoinSlot))
                    rightCoin = true;
                if (rightCoin)
                    data4016 |= 0x40;

                data4017 = 0;
                if (state.IsPressed(DIPSwitch3))
                    data4017 |= 0x04;
                if (state.IsPressed(DIPSwitch4))
                    data4017 |= 0x08;
                if (state.IsPressed(DIPSwitch5))
                    data4017 |= 0x10;
                if (state.IsPressed(DIPSwitch6))
                    data4017 |= 0x20;
                if (state.IsPressed(DIPSwitch7))
                    data4017 |= 0x40;
                if (state.IsPressed(DIPSwitch8))
                    data4017 |= 0x80;
            }
        }
开发者ID:Blizz9,项目名称:FanCut,代码行数:38,代码来源:NesVSUnisystemDIPKeyboardConnection.cs


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