本文整理汇总了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;
}
}
示例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;
}
}