Java Code Examples for org.lwjgl.input.Keyboard#KEY_X
The following examples show how to use
org.lwjgl.input.Keyboard#KEY_X .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyOption.java From opsu-dance with GNU General Public License v3.0 | 5 votes |
@Override public void read(String s) { this.keycode = Keyboard.getKeyIndex(s); if (this.keycode == Keyboard.KEY_NONE) { this.keycode = Keyboard.KEY_X; } }
Example 2
Source File: GuiNBTTree.java From NBTEdit with GNU General Public License v3.0 | 5 votes |
public void keyTyped(char ch, int key) { if (focusedSlotIndex != -1){ saves[focusedSlotIndex].keyTyped(ch, key); } else{ if (key == Keyboard.KEY_C && GuiControls.isCtrlKeyDown()) copy(); if (key == Keyboard.KEY_V && GuiControls.isCtrlKeyDown() && canPaste()) paste(); if (key == Keyboard.KEY_X && GuiControls.isCtrlKeyDown()) cut(); } }
Example 3
Source File: ConfirmationMessage.java From FEMultiplayer with GNU General Public License v3.0 | 5 votes |
public void beginStep(){ List<KeyboardEvent> keys = Game.getKeys(); if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) { repeatTimers[2] = 0.12f; yesHover = !yesHover; AudioPlayer.playAudio("cursor2", 1, 1); } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) { repeatTimers[3] = 0.12f; yesHover = !yesHover; AudioPlayer.playAudio("cursor2", 1, 1); } for(KeyboardEvent ke : keys) { if(ke.state) { if(ke.key == Keyboard.KEY_RETURN || ke.key == Keyboard.KEY_Z) { AudioPlayer.playAudio("select", 1, 1); if(yesHover) confirm(); else cancel(); destroy(); } if(ke.key == Keyboard.KEY_X){ AudioPlayer.playAudio("cancel", 1, 1); cancel(); destroy(); } } } for(int i=0; i<repeatTimers.length; i++) { if(repeatTimers[i] > 0) { repeatTimers[i] -= Game.getDeltaSeconds(); if(repeatTimers[i] < 0) repeatTimers[i] = 0; } } }
Example 4
Source File: GuiNBTEdit.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
@Override protected void keyTyped(char par1, int key) { GuiEditSingleNBT window = this.guiTree.getWindow(); if (window != null) { window.keyTyped(par1, key); } else { this.nbtString.textboxKeyTyped(par1, key); switch (key) { case 1: this.quitWithoutSaving(); break; case 211: this.guiTree.deleteSelected(); break; case 28: this.guiTree.editSelected(); break; case 200: this.guiTree.arrowKeyPressed(true); break; case 208: this.guiTree.arrowKeyPressed(false); break; case Keyboard.KEY_C: if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) { this.guiTree.copy(); } break; case Keyboard.KEY_V: if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) { if (this.guiTree.canPaste()) { this.guiTree.paste(); } } break; case Keyboard.KEY_X: if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) { this.guiTree.cut(); } break; } } }
Example 5
Source File: ActionButtonPanel.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
public final boolean doKeyPressed(KeyboardEvent event) { switch (event.getKeyCode()) { case Keyboard.KEY_M: case Keyboard.KEY_Q: if (current_unit) return true; break; case Keyboard.KEY_A: if ((current_unit || current_armory || current_tower) && !event.isControlDown()) return true; break; case Keyboard.KEY_P: if (current_quarters) return true; if (current_unit) break; case Keyboard.KEY_G: case Keyboard.KEY_T: if (current_unit || current_armory) return true; case Keyboard.KEY_C: case Keyboard.KEY_I: case Keyboard.KEY_W: case Keyboard.KEY_ESCAPE: if (current_armory) if (current_submenu == harvest_group || current_submenu == build_group || current_submenu == army_group || current_submenu == transport_group) return true; break; case Keyboard.KEY_R: if (current_armory || current_quarters) return true; break; case Keyboard.KEY_X: if (current_tower) return true; break; default: break; } return false; }
Example 6
Source File: ClientOverworldStage.java From FEMultiplayer with GNU General Public License v3.0 | 4 votes |
@Override public void beginStep() { super.beginStep(); for (Entity e : entities) { e.beginStep(); } MapAnimation.updateAll(); if (onControl) { List<KeyboardEvent> keys = Game.getKeys(); if (Keyboard.isKeyDown(Keyboard.KEY_UP) && repeatTimers[0] == 0) { context.onUp(); repeatTimers[0] = 0.12f; } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && repeatTimers[1] == 0) { context.onDown(); repeatTimers[1] = 0.12f; } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) { context.onLeft(); repeatTimers[2] = 0.12f; } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) { context.onRight(); repeatTimers[3] = 0.12f; } for(KeyboardEvent ke : keys) { if(ke.state) { if(ke.key == Keyboard.KEY_Z) context.onSelect(); else if (ke.key == Keyboard.KEY_X) context.onCancel(); } } } for(int i=0; i<repeatTimers.length; i++) { if(repeatTimers[i] > 0) { repeatTimers[i] -= Game.getDeltaSeconds(); if(repeatTimers[i] < 0) repeatTimers[i] = 0; } } processAddStack(); processRemoveStack(); }
Example 7
Source File: UnitBuilderStage.java From FEMultiplayer with GNU General Public License v3.0 | 4 votes |
@Override public void beginStep() { for (Entity e : entities) { e.beginStep(); } processAddStack(); processRemoveStack(); MapAnimation.updateAll(); List<KeyboardEvent> keys = Game.getKeys(); if (Keyboard.isKeyDown(Keyboard.KEY_UP) && repeatTimers[0] == 0) { repeatTimers[0] = 0.15f; state.up(); state.updateControls(); } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && repeatTimers[1] == 0) { repeatTimers[1] = 0.15f; state.down(); state.updateControls(); } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) { repeatTimers[2] = 0.15f; state.left(); state.updateControls(); } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) { repeatTimers[3] = 0.15f; state.right(); state.updateControls(); } for(KeyboardEvent ke : keys) { if(ke.state) { if(ke.key == Keyboard.KEY_Z) { state.select(); state.updateControls(); } else if (ke.key == Keyboard.KEY_X){ state.cancel(); state.updateControls(); } } } for(int i=0; i<repeatTimers.length; i++) { if(repeatTimers[i] > 0) { repeatTimers[i] -= Game.getDeltaSeconds(); if(repeatTimers[i] < 0) repeatTimers[i] = 0; } } }
Example 8
Source File: TeamBuilderStage.java From FEMultiplayer with GNU General Public License v3.0 | 4 votes |
@Override public void beginStep() { boolean capture = control; for (Entity e : entities) { e.beginStep(); } processAddStack(); processRemoveStack(); MapAnimation.updateAll(); if(capture){ List<KeyboardEvent> keys = Game.getKeys(); if (Keyboard.isKeyDown(Keyboard.KEY_UP) && repeatTimers[0] == 0) { repeatTimers[0] = 0.15f; if(control) if(!cursor.on){ buttons[currButton].setHover(false); cursor.on = true; cursor.index = cursor.max - 1; cursor.instant = true; controls.set("Z", "Items/Train"); }else if(cursor.index == 0){ cursor.on = false; controls.set("Z", "Select"); buttons[currButton].setHover(true); } else { cursor.up(); } AudioPlayer.playAudio("cursor2", 1, 1); } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && repeatTimers[1] == 0) { repeatTimers[1] = 0.15f; if(!cursor.on){ buttons[currButton].setHover(false); cursor.on = true; cursor.index = 0; cursor.instant = true; controls.set("Z", "Items/Train"); }else if(cursor.index == cursor.max -1){ cursor.on = false; controls.set("Z", "Select"); buttons[currButton].setHover(true); } else { cursor.down(); } AudioPlayer.playAudio("cursor2", 1, 1); } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) { repeatTimers[2] = 0.15f; if(!cursor.on){ buttons[currButton].setHover(false); currButton--; if(currButton < 0) currButton+=4; buttons[currButton].setHover(true); AudioPlayer.playAudio("cursor2", 1, 1); } } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) { repeatTimers[3] = 0.15f; if(!cursor.on){ buttons[currButton].setHover(false); currButton++; currButton%=4; buttons[currButton].setHover(true); AudioPlayer.playAudio("cursor2", 1, 1); } } for(KeyboardEvent ke : keys) { if(ke.state) { if(ke.key == Keyboard.KEY_Z) { AudioPlayer.playAudio("select", 1, 1); if(cursor.on){ FEMultiplayer.setCurrentStage(new UnitBuilderStage(units.get(cursor.getIndex()), this, session)); } else { buttons[currButton].setHover(false); buttons[currButton].execute(); } } else if (ke.key == Keyboard.KEY_X){ if(canEditUnits) { AudioPlayer.playAudio("cancel", 1, 1); select.refresh(); FEMultiplayer.setCurrentStage(select); } } else if (ke.key == Keyboard.KEY_RETURN){ AudioPlayer.playAudio("select", 1, 1); buttons[0].execute(); } } } for(int i=0; i<repeatTimers.length; i++) { if(repeatTimers[i] > 0) { repeatTimers[i] -= Game.getDeltaSeconds(); if(repeatTimers[i] < 0) repeatTimers[i] = 0; } } } }