Java Code Examples for org.lwjgl.input.Keyboard#KEY_END

The following examples show how to use org.lwjgl.input.Keyboard#KEY_END . 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: KeyboardInput.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
private final boolean checkMagicKey(Deterministic deterministic, boolean event_key_state, int event_key, boolean override, boolean repeat) {
	boolean keys_enabled = Settings.getSettings().inDeveloperMode() && control_down && shift_down && !repeat;
	if (event_key_state && (keys_enabled || override)) {
		// check for special events that shouldn't generate events
		switch (event_key) {
			case Keyboard.KEY_RIGHT:
				AnimationManager.warpTime(LITTLE_WARP);
				break;
			case Keyboard.KEY_UP:
				AnimationManager.warpTime(MEDIUM_WARP);
				break;
			case Keyboard.KEY_PRIOR:
				AnimationManager.warpTime(LARGE_WARP);
				break;
			case Keyboard.KEY_Q:
				System.out.println("Exit forced with ctrl+Q");
				Renderer.shutdown();
				break;
			case Keyboard.KEY_SPACE:
				AnimationManager.toggleTimeStop();
				break;
			case Keyboard.KEY_END:
				System.out.println("WARP UNTIL END OF EVENT LOG");
				AnimationManager.warpTime(GOTO_END_OF_LOG_WARP);
				break;
			default:
				break;
		}
	}
	return keys_enabled;
}
 
Example 2
Source File: GuiField.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@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 3
Source File: GameCamera.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
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 4
Source File: EditBox.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
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();
}