android.view.KeyEvent.isGamepadButton()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中android.view.KeyEvent.isGamepadButton()方法的一些代码示例,展示了KeyEvent.isGamepadButton()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.isGamepadButton()方法的具体详情如下:
包路径:android.view.KeyEvent
类名称:KeyEvent
方法名:isGamepadButton

KeyEvent.isGamepadButton介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
public boolean onKey (View view, int keyCode, KeyEvent keyEvent) {
  if (!keyEvent.isGamepadButton(keyCode)) {
    return false;

代码示例来源:origin: JimSeker/bluetooth

/**
 * Any gamepad button + the spacebar or DPAD_CENTER will be used as the fire
 * key.
 *
 * @param keyCode
 * @return true of it's a fire key.
 */
private static boolean isFireKey(int keyCode) {
  return KeyEvent.isGamepadButton(keyCode)
      || keyCode == KeyEvent.KEYCODE_DPAD_CENTER
      || keyCode == KeyEvent.KEYCODE_SPACE;
}

代码示例来源:origin: li2/learning-android-open-source

private static boolean isFireKey(int keyCode) {
  return KeyEvent.isGamepadButton(keyCode)
      || keyCode == KeyEvent.KEYCODE_DPAD_CENTER
      || keyCode == KeyEvent.KEYCODE_SPACE;
}

代码示例来源:origin: qiubiteme/android_api_demos

private static boolean isFireKey(int keyCode) {
  return KeyEvent.isGamepadButton(keyCode)
      || keyCode == KeyEvent.KEYCODE_DPAD_CENTER
      || keyCode == KeyEvent.KEYCODE_SPACE;
}

代码示例来源:origin: bitcraze/crazyflie-android-client

private static boolean isJoystickButton(int keyCode) {
  switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_DPAD_LEFT:
    case KeyEvent.KEYCODE_DPAD_RIGHT:
    case KeyEvent.KEYCODE_DPAD_DOWN:
      return true;
    default:
      return KeyEvent.isGamepadButton(keyCode);
  }
}

代码示例来源:origin: qiubiteme/android_api_demos

private static boolean isGameKey(int keyCode) {
    switch (keyCode) {
      case KeyEvent.KEYCODE_DPAD_UP:
      case KeyEvent.KEYCODE_DPAD_DOWN:
      case KeyEvent.KEYCODE_DPAD_LEFT:
      case KeyEvent.KEYCODE_DPAD_RIGHT:
      case KeyEvent.KEYCODE_DPAD_CENTER:
      case KeyEvent.KEYCODE_SPACE:
        return true;
      default:
        return KeyEvent.isGamepadButton(keyCode);
    }
  }
}

代码示例来源:origin: li2/learning-android-open-source

private static boolean isGameKey(int keyCode) {
    switch (keyCode) {
      case KeyEvent.KEYCODE_DPAD_UP:
      case KeyEvent.KEYCODE_DPAD_DOWN:
      case KeyEvent.KEYCODE_DPAD_LEFT:
      case KeyEvent.KEYCODE_DPAD_RIGHT:
      case KeyEvent.KEYCODE_DPAD_CENTER:
      case KeyEvent.KEYCODE_SPACE:
        return true;
      default:
        return KeyEvent.isGamepadButton(keyCode);
    }
  }
}

代码示例来源:origin: derry/delion

int keyCode = event.getKeyCode();
if (event.getRepeatCount() != 0 || KeyEvent.isModifierKey(keyCode)) return false;
if (KeyEvent.isGamepadButton(keyCode)) {
  if (isGamepadAPIActive(activity)) return false;
} else if (!event.isCtrlPressed() && !event.isAltPressed()

相关文章