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

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

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

Keyboard.isCreated介绍

暂无

代码示例

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

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

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

  1. public boolean isKeyPressed (int key) {
  2. if (!Keyboard.isCreated()) return false;
  3. if (key == Input.Keys.ANY_KEY)
  4. return pressedKeys > 0;
  5. else
  6. return Keyboard.isKeyDown(getLwjglKeyCode(key));
  7. }

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

  1. public boolean isKeyPressed (int key) {
  2. if (!Keyboard.isCreated()) return false;
  3. if (key == Input.Keys.ANY_KEY)
  4. return pressedKeys > 0;
  5. else
  6. return Keyboard.isKeyDown(getLwjglKeyCode(key));
  7. }

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

  1. private void pauseCanvas(){
  2. if (Mouse.isCreated()){
  3. if (Mouse.isGrabbed()){
  4. Mouse.setGrabbed(false);
  5. mouseWasGrabbed = true;
  6. }
  7. mouseWasCreated = true;
  8. Mouse.destroy();
  9. }
  10. if (Keyboard.isCreated()){
  11. keyboardWasCreated = true;
  12. Keyboard.destroy();
  13. }
  14. renderable.set(false);
  15. destroyContext();
  16. }

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

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

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

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

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

  1. if (Keyboard.isCreated()){

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

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

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

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

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

  1. public void init() {
  2. if (!Keyboard.isCreated()) {
  3. try {
  4. Keyboard.create();
  5. } catch (final LWJGLException e) {
  6. throw new RuntimeException(e);
  7. }
  8. }
  9. }

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

  1. public boolean isKeyPressed (int key) {
  2. if (!Keyboard.isCreated()) return false;
  3. if (key == Input.Keys.ANY_KEY)
  4. return pressedKeys > 0;
  5. else
  6. return Keyboard.isKeyDown(getLwjglKeyCode(key));
  7. }

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

  1. public synchronized void pollDevice() throws IOException {
  2. if (!org.lwjgl.input.Keyboard.isCreated())
  3. return;
  4. org.lwjgl.input.Keyboard.poll();
  5. for ( Component component : getComponents() ) {
  6. Key key = (Key)component;
  7. key.update();
  8. }
  9. }

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

  1. private void pauseCanvas(){
  2. if (Mouse.isCreated()){
  3. if (Mouse.isGrabbed()){
  4. Mouse.setGrabbed(false);
  5. mouseWasGrabbed = true;
  6. }
  7. mouseWasCreated = true;
  8. Mouse.destroy();
  9. }
  10. if (Keyboard.isCreated()){
  11. keyboardWasCreated = true;
  12. Keyboard.destroy();
  13. }
  14. renderable.set(false);
  15. destroyContext();
  16. }

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

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

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

  1. protected synchronized boolean getNextDeviceEvent(Event event) throws IOException {
  2. if (!org.lwjgl.input.Keyboard.isCreated())
  3. return false;
  4. if (!org.lwjgl.input.Keyboard.next())
  5. return false;
  6. int lwjgl_key = org.lwjgl.input.Keyboard.getEventKey();
  7. if (lwjgl_key == org.lwjgl.input.Keyboard.KEY_NONE)
  8. return false;
  9. Component.Identifier.Key key_id = KeyMap.map(lwjgl_key);
  10. if (key_id == null)
  11. return false;
  12. Component key = getComponent(key_id);
  13. if (key == null)
  14. return false;
  15. float value = org.lwjgl.input.Keyboard.getEventKeyState() ? 1 : 0;
  16. event.set(key, value, org.lwjgl.input.Keyboard.getEventNanoseconds());
  17. return true;
  18. }

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

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

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

  1. @SideOnly(Side.CLIENT)
  2. @SubscribeEvent
  3. public void onItemTooltipEvent(ItemTooltipEvent event) {
  4. if (Keyboard.isCreated()
  5. && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
  6. // https://www.reddit.com/r/minecraftsuggestions/comments/3brh7v/when_hovering_over_a_food_it_shows_how_many_food/
  7. ItemStack itemStack = event.getItemStack();
  8. if (itemStack.getItem() == null) {
  9. return;
  10. }
  11. if (foodDetails && itemStack.getItem() instanceof ItemFood) {
  12. ItemFood food = (ItemFood) itemStack.getItem();
  13. int hunger = food.getHealAmount(itemStack);
  14. float satur = food.getSaturationModifier(itemStack);
  15. if (hunger > 0 || satur > 0) {
  16. event.getToolTip().add(hunger + " (" + satur + ")");
  17. }
  18. }
  19. if (fuelDetails) {
  20. int burnTime = TileEntityFurnace.getItemBurnTime(itemStack);
  21. if (burnTime > 0) {
  22. event.getToolTip().add(UtilChat.lang("tooltip.burntime") + burnTime);
  23. }
  24. }
  25. }
  26. }

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

  1. if (Keyboard.isCreated()){

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

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

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

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

相关文章