Java Code Examples for org.lwjgl.glfw.GLFW#GLFW_KEY_LEFT

The following examples show how to use org.lwjgl.glfw.GLFW#GLFW_KEY_LEFT . 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: TabGui.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onKeyPress(KeyPressEvent event)
{
	if(event.getAction() != GLFW.GLFW_PRESS)
		return;
	
	if(tabGuiOtf.isHidden())
		return;
	
	if(tabOpened)
		switch(event.getKeyCode())
		{
			case GLFW.GLFW_KEY_LEFT:
			tabOpened = false;
			break;
			
			default:
			tabs.get(selected).onKeyPress(event.getKeyCode());
			break;
		}
	else
		switch(event.getKeyCode())
		{
			case GLFW.GLFW_KEY_DOWN:
			if(selected < tabs.size() - 1)
				selected++;
			else
				selected = 0;
			break;
			
			case GLFW.GLFW_KEY_UP:
			if(selected > 0)
				selected--;
			else
				selected = tabs.size() - 1;
			break;
			
			case GLFW.GLFW_KEY_RIGHT:
			tabOpened = true;
			break;
		}
}
 
Example 2
Source File: WAbstractSlider.java    From LibGui with MIT License 2 votes vote down vote up
/**
 * Tests if the key should decrease sliders with the specified direction.
 *
 * @param ch        the key code
 * @param direction the direction
 * @return true if the key should decrease sliders with the direction, false otherwise
 * @since 2.0.0
 */
public static boolean isDecreasingKey(int ch, Direction direction) {
	return direction.isInverted()
			? (ch == GLFW.GLFW_KEY_RIGHT || ch == GLFW.GLFW_KEY_UP)
			: (ch == GLFW.GLFW_KEY_LEFT || ch == GLFW.GLFW_KEY_DOWN);
}
 
Example 3
Source File: WAbstractSlider.java    From LibGui with MIT License 2 votes vote down vote up
/**
 * Tests if the key should increase sliders with the specified direction.
 *
 * @param ch        the key code
 * @param direction the direction
 * @return true if the key should increase sliders with the direction, false otherwise
 * @since 2.0.0
 */
public static boolean isIncreasingKey(int ch, Direction direction) {
	return direction.isInverted()
			? (ch == GLFW.GLFW_KEY_LEFT || ch == GLFW.GLFW_KEY_DOWN)
			: (ch == GLFW.GLFW_KEY_RIGHT || ch == GLFW.GLFW_KEY_UP);
}