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

The following examples show how to use org.lwjgl.glfw.GLFW#GLFW_KEY_ENTER . 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 6 votes vote down vote up
public void onKeyPress(int keyCode)
{
	switch(keyCode)
	{
		case GLFW.GLFW_KEY_DOWN:
		if(selected < features.size() - 1)
			selected++;
		else
			selected = 0;
		break;
		
		case GLFW.GLFW_KEY_UP:
		if(selected > 0)
			selected--;
		else
			selected = features.size() - 1;
		break;
		
		case GLFW.GLFW_KEY_ENTER:
		onEnter();
		break;
	}
}
 
Example 2
Source File: EnterProfileNameScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	switch(keyCode)
	{
		case GLFW.GLFW_KEY_ENTER:
		done();
		break;
		
		case GLFW.GLFW_KEY_ESCAPE:
		client.openScreen(prevScreen);
		break;
	}
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 3
Source File: EditBlockScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	switch(keyCode)
	{
		case GLFW.GLFW_KEY_ENTER:
		done();
		break;
		
		case GLFW.GLFW_KEY_ESCAPE:
		client.openScreen(prevScreen);
		break;
	}
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 4
Source File: EditSliderScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	switch(keyCode)
	{
		case GLFW.GLFW_KEY_ENTER:
		done();
		break;
		
		case GLFW.GLFW_KEY_ESCAPE:
		client.openScreen(prevScreen);
		break;
	}
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 5
Source File: TextArea.java    From LWJGUI with MIT License 6 votes vote down vote up
@Override
public void process(TextInputControl tic, KeyEvent event) {
	super.process(tic, event);
	
	if ( event.isConsumed() )
		return;
	
	if ( !tic.isEditing() )
		return;
	
	// Enter
	if (event.key == GLFW.GLFW_KEY_ENTER ) {
		tic.saveState();
		tic.deleteSelection();
		tic.insertText(tic.getCaretPosition(), "\n");
		tic.setCaretPosition(tic.getCaretPosition()+1);
		tic.deselect();
	}
	
	// Tab
	if (event.key == GLFW.GLFW_KEY_TAB ) {
		tic.tab();
	}
}
 
Example 6
Source File: KeybindManagerScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		if(editButton.active)
			editButton.onPress();
		else
			addButton.onPress();
	else if(keyCode == GLFW.GLFW_KEY_DELETE)
		removeButton.onPress();
	else if(keyCode == GLFW.GLFW_KEY_ESCAPE)
		backButton.onPress();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 7
Source File: KeybindProfilesScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		loadSelected();
	else if(keyCode == GLFW.GLFW_KEY_ESCAPE)
		openPrevScreen();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 8
Source File: EditBlockListScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		addButton.onPress();
	else if(keyCode == GLFW.GLFW_KEY_DELETE)
		removeButton.onPress();
	else if(keyCode == GLFW.GLFW_KEY_ESCAPE)
		doneButton.onPress();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 9
Source File: SelectFileScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		done();
	else if(keyCode == GLFW.GLFW_KEY_ESCAPE)
		openPrevScreen();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 10
Source File: EditItemListScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		addButton.onPress();
	else if(keyCode == GLFW.GLFW_KEY_DELETE)
		removeButton.onPress();
	else if(keyCode == GLFW.GLFW_KEY_ESCAPE)
		doneButton.onPress();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 11
Source File: AltEditorScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		doneButton.onPress();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 12
Source File: AltManagerScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		useButton.onPress();
	
	return super.keyPressed(keyCode, scanCode, modifiers);
}
 
Example 13
Source File: CleanUpScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		cleanUpButton.onPress();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 14
Source File: ServerFinderScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean keyPressed(int keyCode, int scanCode, int int_3)
{
	if(keyCode == GLFW.GLFW_KEY_ENTER)
		searchButton.onPress();
	
	return super.keyPressed(keyCode, scanCode, int_3);
}
 
Example 15
Source File: WWidget.java    From LibGui with MIT License 2 votes vote down vote up
/**
 * Tests if the provided key code is an activation key for widgets.
 *
 * <p>The activation keys are Enter, keypad Enter, and Space.
 *
 * @param ch the key code
 * @return whether the key is an activation key
 * @since 2.0.0
 */
@Environment(EnvType.CLIENT)
public static boolean isActivationKey(int ch) {
	return ch == GLFW.GLFW_KEY_ENTER || ch == GLFW.GLFW_KEY_KP_ENTER || ch == GLFW.GLFW_KEY_SPACE;
}