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

The following examples show how to use org.lwjgl.input.Keyboard#KEY_LSHIFT . 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
public final boolean doPoll(GUIRoot gui_root) {
	Deterministic deterministic = LocalEventQueue.getQueue().getDeterministic();
	LocalInput local_input = LocalInput.getLocalInput();
	boolean result = false;
	Keyboard.poll();
	while (deterministic.log(Keyboard.next())) {
		result = true;
		int event_key = deterministic.log(Keyboard.getEventKey());
		boolean event_key_state = deterministic.log(Keyboard.getEventKeyState());
		char event_character = deterministic.log(Keyboard.getEventCharacter());
		boolean repeat_event = deterministic.log(Keyboard.isRepeatEvent());
		switch (event_key) {
			case Keyboard.KEY_LSHIFT:
			case Keyboard.KEY_RSHIFT:
				shift_down = event_key_state;
				break;
			case Keyboard.KEY_LCONTROL:
			case Keyboard.KEY_RCONTROL:
				control_down = event_key_state;
				break;
			case Keyboard.KEY_LMENU:
			case Keyboard.KEY_RMENU:
				menu_down = event_key_state;
				break;
		}
		if (checkMagicKey(deterministic, event_key_state, event_key, false, repeat_event))
			continue;
		if (event_key == Keyboard.KEY_NONE) {
			local_input.keyTyped(gui_root, event_key, event_character);
		} else if (event_key_state) {
			local_input.keyPressed(gui_root, event_key, event_character, shift_down, control_down, menu_down, repeat_event);
		} else {
			local_input.keyReleased(gui_root, event_key, event_character, shift_down, control_down, menu_down);
		}
	}
	return result;
}
 
Example 2
Source File: InputEventHandler.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onGuiKeyInputEventPre(GuiScreenEvent.KeyboardInputEvent.Pre event)
{
    if (event.getGui() instanceof GuiHandyBag)
    {
        int key = Keyboard.getEventKey();

        // Double-tap shift
        if (Keyboard.getEventKeyState() && (key == Keyboard.KEY_LSHIFT || key == Keyboard.KEY_RSHIFT) && this.checkForDoubleTap(key))
        {
            PacketHandler.INSTANCE.sendToServer(new MessageGuiAction(0, new BlockPos(0, 0, 0),
                ReferenceGuiIds.GUI_ID_HANDY_BAG, ItemHandyBag.GUI_ACTION_TOGGLE_SHIFTCLICK_DOUBLETAP, 0));
        }
    }
}
 
Example 3
Source File: UploadScreenshotKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public UploadScreenshotKeybind() {
    super("Upload Screenshot", Keyboard.KEY_LSHIFT);
    conflictExempt = true;
}
 
Example 4
Source File: OptionsOverlay.java    From opsu-dance with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void keyPressed(KeyEvent e)
{
	e.consume();

	if (keyEntryRight) {
		if (Utils.isValidGameKey(e.keyCode)) {
			OPTION_KEY_RIGHT.setKeycode(e.keyCode);
		}
		keyEntryRight = false;
		return;
	}

	if (keyEntryLeft) {
		if (Utils.isValidGameKey(e.keyCode)) {
			OPTION_KEY_LEFT.setKeycode(e.keyCode);
		}
		keyEntryLeft = false;
		return;
	}

	if (e.keyCode == Keyboard.KEY_ESCAPE) {
		if (isAdjustingSlider) {
			cancelAdjustingSlider();
		}
		if (lastSearchText.length() != 0) {
			resetSearch();
			updateHoverOption(
				prevMouseX,
				prevMouseY,
				displayContainer.suppressHover
			);
			return;
		}
		this.exit();
		return;
	}

	if ((e.keyCode == Keyboard.KEY_RSHIFT || e.keyCode == Keyboard.KEY_LSHIFT) &&
		!Keyboard.isRepeatEvent() &&
		this.isAdjustingSlider)
	{
		this.sliderOptionPrecisionStartX = mouseX;
	}

	searchField.keyPressed(e);
	if (!searchField.getText().equals(lastSearchText)) {
		String newSearchText = searchField.getText().toLowerCase();
		if (!hasSearchResults(newSearchText)) {
			searchField.setText(lastSearchText);
			invalidSearchAnimationProgress = INVALID_SEARCH_ANIMATION_TIME;
			Random rand = new Random();
			invalidSearchImgRotation = 10 + rand.nextInt(10);
			invalidSearchTextRotation = 10 + rand.nextInt(10);
			if (rand.nextBoolean()) {
				invalidSearchImgRotation = -invalidSearchImgRotation;
			}
			if (rand.nextBoolean()) {
				invalidSearchTextRotation = -invalidSearchTextRotation;
			}
		} else {
			lastSearchText = newSearchText;
			updateSearch();
		}
	}
}
 
Example 5
Source File: GuiCyberwareMenu.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{

	if (keyCode == Keyboard.KEY_ESCAPE)
	{
		if (editing)
		{
			this.editing = false;
		}
		else
		{
			close = true;
		}
	}
	else if (keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT)
	{
		
	}
	else if (keyCode == KeyBinds.menu.getKeyCode())
	{
		
	}
	else if (this.selectedPart != -1 && editing)
	{
		boolean shiftPressed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
		assignHotkey(keyCode + (shiftPressed ? 900 : 0));
		/*for (int i = 0; i < mc.gameSettings.keyBindsHotbar.length; i++)
		{
			KeyBinding kb = mc.gameSettings.keyBindsHotbar[i];
			if (kb.getKeyCode() == keyCode)
			{
				ICyberwareUserData data = CyberwareAPI.getCapability(mc.thePlayer);
				
				if (HotkeyHelper.getHotkey(data.getActiveItems().get(selectedPart)) != i)
				{
					HotkeyHelper.removeHotkey(data, i);
					HotkeyHelper.assignHotkey(data, data.getActiveItems().get(selectedPart), i);
					CyberwarePacketHandler.INSTANCE.sendToServer(new SyncHotkeyPacket(selectedPart, i));
				}

				return;
			}
		}*/
	}
	
	hex.textboxKeyTyped(typedChar, keyCode);
	if (hex.getText().length() >= 12)
	{
		hex.setText(hex.getText().substring(6, 12));
	}
	if (hex.getText().length() > 6)
	{
		hex.setText(hex.getText().substring(0, 6));
	}
	hex.setText(hex.getText().replaceAll("[^0-9AaBbCcDdEeFf]", ""));
	if (hex.getText().length() == 6)
	{
		CyberwareAPI.setHUDColor(Integer.parseInt(hex.getText(), 16));
	}
}