Java Code Examples for org.lwjgl.input.Keyboard#KEY_HOME
The following examples show how to use
org.lwjgl.input.Keyboard#KEY_HOME .
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: GuiField.java From WearableBackpacks with MIT License | 5 votes |
@Override public void onKey(int keyCode, char keyChar) { if (!isEnabled() && (keyCode != Keyboard.KEY_LEFT) && (keyCode != Keyboard.KEY_RIGHT) && (keyCode != Keyboard.KEY_HOME) && (keyCode != Keyboard.KEY_END)) return; String beforeText = getText(); if (!Character.isISOControl(keyChar) && !isCharValid(keyChar)) return; _field.textboxKeyTyped(keyChar, keyCode); if (!getText().equals(beforeText)) onTextChanged(); }
Example 2
Source File: GameCamera.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
public final void keyPressed(KeyboardEvent event) { switch (event.getKeyCode()) { case Keyboard.KEY_HOME: case Keyboard.KEY_NUMPAD8: break; case Keyboard.KEY_END: case Keyboard.KEY_NUMPAD2: break; case Keyboard.KEY_INSERT: case Keyboard.KEY_NUMPAD6: viewer.getPicker().pickRotate(this); break; case Keyboard.KEY_DELETE: case Keyboard.KEY_NUMPAD4: viewer.getPicker().pickRotate(this); break; case Keyboard.KEY_PRIOR: case Keyboard.KEY_NUMPAD9: mouseScrolled(-2); break; case Keyboard.KEY_NEXT: case Keyboard.KEY_NUMPAD3: mouseScrolled(2); break; case Keyboard.KEY_UP: if (!scrollSpeedLocked(Keyboard.KEY_UP)) { scroll_acceleration_seconds = 0; setScrollSpeed(); } break; case Keyboard.KEY_DOWN: if (!scrollSpeedLocked(Keyboard.KEY_DOWN)) { scroll_acceleration_seconds = 0; setScrollSpeed(); } break; case Keyboard.KEY_LEFT: if (!scrollSpeedLocked(Keyboard.KEY_LEFT)) { scroll_acceleration_seconds = 0; setScrollSpeed(); } break; case Keyboard.KEY_RIGHT: if (!scrollSpeedLocked(Keyboard.KEY_RIGHT)) { scroll_acceleration_seconds = 0; setScrollSpeed(); } break; } }
Example 3
Source File: EditBox.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
protected final void keyRepeat(KeyboardEvent event) { //char ch = event.getKeyChar(); Box edit_box = Skin.getSkin().getEditBox(); switch (event.getKeyCode()) { case Keyboard.KEY_RETURN: if (insert(index, '\n')) { index++; } break; case Keyboard.KEY_BACK: if (index > 0) delete(--index); break; case Keyboard.KEY_DELETE: if (index < getText().length()) delete(index); break; case Keyboard.KEY_LEFT: if (index > 0) index--; break; case Keyboard.KEY_RIGHT: if (index < getText().length()) index++; break; case Keyboard.KEY_UP: index = getTextRenderer().jump(edit_box.getLeftOffset(), edit_box.getBottomOffset(), 0, getFont().getHeight(), getText(), index); break; case Keyboard.KEY_DOWN: index = getTextRenderer().jump(edit_box.getLeftOffset(), edit_box.getBottomOffset(), 0, -getFont().getHeight(), getText(), index); break; case Keyboard.KEY_HOME: index = getTextRenderer().jump(edit_box.getLeftOffset(), edit_box.getBottomOffset(), -getWidth(), 0, getText(), index); break; case Keyboard.KEY_END: index = getTextRenderer().jump(edit_box.getLeftOffset(), edit_box.getBottomOffset(), getWidth(), 0, getText(), index); break; case Keyboard.KEY_TAB: case Keyboard.KEY_ESCAPE: super.keyRepeat(event); break; default: char key = event.getKeyChar(); if (getFont().getQuad(key) != null) { if (insert(index, key)) index++; } else { super.keyRepeat(event); } break; } correctOffsetY(); }