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

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

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

Keyboard.isCreated介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public boolean isInitialized() {
  return Keyboard.isCreated();
}

代码示例来源: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: jMonkeyEngine/jmonkeyengine

private void pauseCanvas(){
  if (Mouse.isCreated()){
    if (Mouse.isGrabbed()){
      Mouse.setGrabbed(false);
      mouseWasGrabbed = true;
    }
    mouseWasCreated = true;
    Mouse.destroy();
  }
  if (Keyboard.isCreated()){
    keyboardWasCreated = true;
    Keyboard.destroy();
  }
  renderable.set(false);
  destroyContext();
}

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

if (Keyboard.isCreated()) {
  while (Keyboard.next()) {
    int keyCode = getGdxKeyCode(Keyboard.getEventKey());

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

if (Keyboard.isCreated()) {
  while (Keyboard.next()) {
    int keyCode = getGdxKeyCode(Keyboard.getEventKey());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (Keyboard.isCreated()){

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (Keyboard.isCreated()){
  Keyboard.destroy();

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

public boolean isInitialized() {
  return Keyboard.isCreated();
}

代码示例来源:origin: com.ardor3d/ardor3d-lwjgl

public void init() {
  if (!Keyboard.isCreated()) {
    try {
      Keyboard.create();
    } catch (final LWJGLException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源: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: org.lwjgl.lwjgl/lwjgl_util

public synchronized void pollDevice() throws IOException {
  if (!org.lwjgl.input.Keyboard.isCreated())
    return;
  org.lwjgl.input.Keyboard.poll();
  for ( Component component : getComponents() ) {
    Key key = (Key)component;
    key.update();
  }
}

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

private void pauseCanvas(){
  if (Mouse.isCreated()){
    if (Mouse.isGrabbed()){
      Mouse.setGrabbed(false);
      mouseWasGrabbed = true;
    }
    mouseWasCreated = true;
    Mouse.destroy();
  }
  if (Keyboard.isCreated()){
    keyboardWasCreated = true;
    Keyboard.destroy();
  }
  renderable.set(false);
  destroyContext();
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, net.minecraft.client.util.ITooltipFlag advanced) {
 ISpell spell = SpellRegistry.getSpellFromID(Spells.getSpellIDCurrent(stack));
 if (Keyboard.isCreated() && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
  tooltip.add(TextFormatting.GREEN + spell.getName() + " "
    + "[" + UtilChat.lang(BuildType.getName(stack)) + "] ");
  tooltip.add(TextFormatting.DARK_GRAY + UtilChat.lang("item.cyclic_wand.tooltiprange") + BaseSpellRange.maxRange);
  tooltip.add(TextFormatting.DARK_GRAY + UtilChat.lang("item.cyclic_wand.shifting"));
 }
 else {
  tooltip.add(TextFormatting.DARK_GRAY + UtilChat.lang("item.shift"));
 }
 super.addInformation(stack, playerIn, tooltip, advanced);
}

代码示例来源:origin: org.lwjgl.lwjgl/lwjgl_util

protected synchronized boolean getNextDeviceEvent(Event event) throws IOException {
  if (!org.lwjgl.input.Keyboard.isCreated())
    return false;
  if (!org.lwjgl.input.Keyboard.next())
    return false;
  int lwjgl_key = org.lwjgl.input.Keyboard.getEventKey();
  if (lwjgl_key == org.lwjgl.input.Keyboard.KEY_NONE)
    return false;
  Component.Identifier.Key key_id = KeyMap.map(lwjgl_key);
  if (key_id == null)
    return false;
  Component key = getComponent(key_id);
  if (key == null)
    return false;
  float value = org.lwjgl.input.Keyboard.getEventKeyState() ? 1 : 0;
  event.set(key, value, org.lwjgl.input.Keyboard.getEventNanoseconds());
  return true;
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
private boolean isGuiKeyDown(KeyBinding keybinding) {
 if (keybinding == null) {
  return false;
 } //i think this fixes the bug? : // https://github.com/PrinceOfAmber/Cyclic/issues/198
 // inside a GUI , we have to check the keyboard directly
 // thanks to Inventory tweaks, reminding me of alternate way to check
 // keydown while in config
 // https://github.com/Inventory-Tweaks/inventory-tweaks/blob/develop/src/main/java/invtweaks/InvTweaks.java
 try { //but just to be careful, add the trycatch also
  boolean bindingPressed = keybinding.isPressed();
  boolean isKeyDown = Keyboard.isCreated() && Keyboard.isKeyDown(keybinding.getKeyCode());
  boolean validKeyModifier = (keybinding.getKeyModifier() == null ||
    keybinding.getKeyModifier().isActive());
  return bindingPressed || //either keybinding object knows its presed, ir the keyboard knows its pressed with the mod
    (isKeyDown && validKeyModifier);
 }
 catch (Exception e) {
  //java.lang.IndexOutOfBoundsException  from org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:407)
  return false;
 }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onItemTooltipEvent(ItemTooltipEvent event) {
 if (Keyboard.isCreated()
   && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
  // https://www.reddit.com/r/minecraftsuggestions/comments/3brh7v/when_hovering_over_a_food_it_shows_how_many_food/
  ItemStack itemStack = event.getItemStack();
  if (itemStack.getItem() == null) {
   return;
  }
  if (foodDetails && itemStack.getItem() instanceof ItemFood) {
   ItemFood food = (ItemFood) itemStack.getItem();
   int hunger = food.getHealAmount(itemStack);
   float satur = food.getSaturationModifier(itemStack);
   if (hunger > 0 || satur > 0) {
    event.getToolTip().add(hunger + " (" + satur + ")");
   }
  }
  if (fuelDetails) {
   int burnTime = TileEntityFurnace.getItemBurnTime(itemStack);
   if (burnTime > 0) {
    event.getToolTip().add(UtilChat.lang("tooltip.burntime") + burnTime);
   }
  }
 }
}

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

if (Keyboard.isCreated()){

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

if (Keyboard.isCreated()){
  Keyboard.destroy();

代码示例来源:origin: TeamWizardry/Wizardry

if (player == null) return;
if (Keyboard.isCreated() && event.getDwheel() != 0 && player.isSneaking()) {

相关文章