org.lwjgl.input.Keyboard.isKeyDown()方法的使用及代码示例

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

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

Keyboard.isKeyDown介绍

暂无

代码示例

代码示例来源:origin: MovingBlocks/Terasology

@Override
public boolean isKeyDown(int key) {
  return Keyboard.isKeyDown(key);
}

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

public boolean isKeyPressed (int key) {
  if (!Keyboard.isCreated()) return false;
  if (key == Input.Keys.ANY_KEY)
    return pressedKeys > 0;
  else
    return Keyboard.isKeyDown(getLwjglKeyCode(key));
}

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

public boolean isKeyPressed (int key) {
  if (!Keyboard.isCreated()) return false;
  if (key == Input.Keys.ANY_KEY)
    return pressedKeys > 0;
  else
    return Keyboard.isKeyDown(getLwjglKeyCode(key));
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

public static boolean isCtrlKeyDown() {
 // prioritize CONTROL, but allow OPTION as well on Mac (note: GuiScreen's isCtrlKeyDown only checks for the OPTION key on Mac)
 boolean isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
 if(!isCtrlKeyDown && Minecraft.IS_RUNNING_ON_MAC) {
  isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA);
 }
 return isCtrlKeyDown;
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

public static boolean isShiftKeyDown() {
 return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}

代码示例来源:origin: Vazkii/Botania

@SubscribeEvent
public void onTick(ClientTickEvent event) {
  if(event.phase != Phase.END)
    return;
  GuiScreen screen = Minecraft.getMinecraft().currentScreen;
  if(!(screen instanceof GuiChat)) {
    isAutoCompleted = false;
    return;
  }
  GuiChat chat = (GuiChat) screen;
  if(isAutoCompleted) {
    boolean valid = false;//ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.COMPLETE_FLAG);
    if(!valid)
      isAutoCompleted = false;
  }
  if(Keyboard.isKeyDown(15)) {
    if(tabLastTick)
      return;
    tabLastTick = true;
  } else {
    tabLastTick = false;
    return;
  }
  if(!CorporeaHelper.shouldAutoComplete())
    return;
  if(!isAutoCompleted)
    buildAutoCompletes(chat.inputField, chat);
  if(isAutoCompleted && !completions.isEmpty())
    advanceAutoComplete(chat.inputField, chat);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
  public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity )
  {
    boolean shiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
    if( shiftHeld )
    {
      ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
      ItemStack output = iep.getOutput( stack );
      if( !output.isEmpty() )
      {
        IBakedModel realModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel( output );
        // Give the item model a chance to handle the overrides as well
        realModel = realModel.getOverrides().handleItemState( realModel, output, world, entity );
        return new ShiftHoldingModelWrapper( realModel );
      }
    }
    return ItemEncodedPatternBakedModel.this.baseModel.getOverrides().handleItemState( originalModel, stack, world, entity );
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * Check if a particular key is down
 * 
 * @param code The key code of the key to check
 * @return True if the key is down
 */
public boolean isKeyDown(int code) {
  return Keyboard.isKeyDown(code);
}

代码示例来源:origin: ldtteam/minecolonies

private static void updateDebugging()
{
  debugging = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)
         && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)
         && Keyboard.isKeyDown(Keyboard.KEY_LMENU);
}

代码示例来源:origin: MrCrayfish/ModelCreator

public static boolean isAltKeyDown()
  {
    return Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU);
  }
}

代码示例来源:origin: McJtyMods/DeepResonance

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag advancedToolTip) {
  super.addInformation(itemStack, player, list, advancedToolTip);
  if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
    list.add("This machine smelts resonating ore and produces liquid");
    list.add("crystal in a tank placed on top of this.");
    list.add("Below the smelter place a tank about half-filled with lava");
  } else {
    list.add(TextFormatting.WHITE + ClientHandler.getShiftMessage());
  }
}

代码示例来源:origin: McJtyMods/DeepResonance

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag advancedToolTip) {
  super.addInformation(itemStack, player, list, advancedToolTip);
  if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
    list.add("Place this block on a tank and aim an");
    list.add("infusion laser at it to enhance the liquid");
    list.add("in the tank");
  } else {
    list.add(TextFormatting.WHITE + ClientHandler.getShiftMessage());
  }
}

代码示例来源:origin: McJtyMods/DeepResonance

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag advancedToolTip) {
  super.addInformation(itemStack, player, list,advancedToolTip);
  if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
    list.add("This machine will transfer fluids from the upper tank");
    list.add("to a tank below if the fluid matches certain conditions");
  } else {
    list.add(TextFormatting.WHITE + ClientHandler.getShiftMessage());
  }
}

代码示例来源:origin: ExtraCells/ExtraCells2

private void modifyAmount(int amount) {
  if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
    amount *= 100;
  }
  NetworkUtil.sendToServer(new PacketPartConfig(part, PacketPartConfig.FLUID_EMITTER_AMOUNT_CHANGE, Integer.toString(amount)));
}

代码示例来源:origin: Vazkii/Psi

public boolean isKeyDown(KeyBinding keybind) {
  int key = keybind.getKeyCode();
  if(key < 0) {
    int button = 100 + key;
    return Mouse.isButtonDown(button);
  }
  return Keyboard.isKeyDown(key);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

public boolean isKeyPressed (int key) {
  if (!Keyboard.isCreated()) return false;
  if (key == Input.Keys.ANY_KEY)
    return pressedKeys > 0;
  else
    return Keyboard.isKeyDown(getLwjglKeyCode(key));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( Keyboard.isKeyDown( Keyboard.KEY_SPACE ) )

代码示例来源:origin: Vazkii/Quark

@Override
boolean renderKey(Minecraft mc, boolean canHover, CoordinateHolder c) {
  boolean hovered = (canHover && isHovered(c)) || Keyboard.isKeyDown(getKey(clicks));
  int u = 320 + w * type;
  int v = hovered ? h : 0;
  drawModalRectWithCustomSizedTexture(c.baseX + x, c.baseY + y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
  if(hovered)
    renderNote(mc, c);
  return hovered;
}

代码示例来源:origin: Vazkii/Quark

@Override
boolean renderKey(Minecraft mc, boolean canHover, CoordinateHolder c) {
  boolean hovered = (canHover && isHovered(c)) || Keyboard.isKeyDown(getKey(clicks));
  int u = 374;
  int v = hovered ? h : 0;
  drawModalRectWithCustomSizedTexture(c.baseX + x, c.baseY + y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
  if(hovered)
    renderNote(mc, c);
  return hovered;
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
  super.addInformation(stack, worldIn, tooltip, flagIn);
  if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
    FluidIdentifierStack fluidStack = SimpleServiceLocator.logisticsFluidManager.getFluidFromContainer(ItemIdentifierStack.getFromStack(stack));
    if (fluidStack != null) {
      tooltip.add("Type:  " + fluidStack.makeFluidStack().getFluid().getLocalizedName(fluidStack.makeFluidStack()));
      tooltip.add("Value: " + fluidStack.getAmount() + "mB");
    }
  }
}

相关文章