Java Code Examples for org.lwjgl.input.Keyboard#KEY_C
The following examples show how to use
org.lwjgl.input.Keyboard#KEY_C .
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: 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 2
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 3
Source File: TextInputBox.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 4 votes |
public void beginStep() { if (hasFocus) { List<KeyboardEvent> keys = Game.getKeys(); for (KeyboardEvent ke : keys) { if (ke.state) { char c = ke.eventChar; if(ke.isControlDown()) switch(ke.key){ case Keyboard.KEY_C: Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(input.toString()), null); continue; case Keyboard.KEY_V: String clip = getClipboardContent(); for(char ch : clip.toCharArray()) { if (isValidCharacter(ch) && FEResources.getBitmapFont("default_med").getStringWidth(input.toString() + ch) < 246) { input.insert(cursorPos, ch); cursorPos++; } } continue; } if (isValidCharacter(c) && FEResources.getBitmapFont("default_med").getStringWidth(input.toString() + c) < 246) { input.insert(cursorPos, c); cursorPos++; } else { if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_LEFT) && cursorPos > 0) { cursorPos--; } else if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_RIGHT) && cursorPos < input.length()) { cursorPos++; } else if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_BACK) && cursorPos > 0) { input.deleteCharAt(cursorPos - 1); cursorPos--; } else if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_DELETE) && cursorPos < input.length()) { input.deleteCharAt(cursorPos); } } } } } }
Example 4
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 5
Source File: ActionButtonPanel.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
public final boolean doKeyReleased(KeyboardEvent event) { switch (event.getKeyCode()) { case Keyboard.KEY_C: if (current_armory) { if (current_submenu == harvest_group) { harvest_rubber_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == build_group) { build_weapon_rubber_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == army_group) { army_warrior_rubber_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == transport_group) { transport_rubber_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else { break; } return true; } break; case Keyboard.KEY_P: if (current_quarters) { quarters_peon_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); return true; } if (current_armory) { if (current_submenu == army_group) { army_peon_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else { break; } return true; } break; case Keyboard.KEY_I: if (current_armory) { if (current_submenu == harvest_group) { harvest_iron_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == build_group) { build_weapon_iron_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == army_group) { army_warrior_iron_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == transport_group) { transport_iron_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else { break; } return true; } break; case Keyboard.KEY_R: if (current_armory) { if (current_submenu == harvest_group) { harvest_rock_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == build_group) { build_weapon_rock_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == army_group) { army_warrior_rock_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == transport_group) { transport_rock_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else { break; } return true; } break; case Keyboard.KEY_T: if (current_armory) { if (current_submenu == null) { transport_button.mouseClickedAll(LocalInput.LEFT_BUTTON, 0, 0, 1); } else { break; } return true; } break; case Keyboard.KEY_W: if (current_armory) { if (current_submenu == harvest_group) { harvest_tree_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else if (current_submenu == transport_group) { transport_tree_button.shortcutReleased(event.isShiftDown(), event.isControlDown()); } else { break; } return true; } break; default: break; } return false; }
Example 6
Source File: CraftingGridKeyHandler.java From Translocators with MIT License | 4 votes |
private CraftingGridKeyHandler() { super("key.craftingGrid", Keyboard.KEY_C, "key.categories.gameplay"); }