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

The following examples show how to use org.lwjgl.input.Keyboard#KEY_A . 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: LocationEditGui.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Allow moving the last hovered feature with arrow keys.
 */
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
    super.keyTyped(typedChar, keyCode);
    Feature hoveredFeature = ButtonLocation.getLastHoveredFeature();
    if (hoveredFeature != null) {
        int xOffset = 0;
        int yOffset = 0;
        if (keyCode == Keyboard.KEY_LEFT) {
            xOffset--;
        } else if (keyCode == Keyboard.KEY_UP) {
            yOffset--;
        } else if (keyCode == Keyboard.KEY_RIGHT) {
            xOffset++;
        } else if (keyCode == Keyboard.KEY_DOWN) {
            yOffset++;
        }
        if (keyCode == Keyboard.KEY_A) {
            xOffset-= 10;
        } else if (keyCode == Keyboard.KEY_W) {
            yOffset-= 10;
        } else if (keyCode == Keyboard.KEY_D) {
            xOffset+= 10;
        } else if (keyCode == Keyboard.KEY_S) {
            yOffset+= 10;
        }
        main.getConfigValues().setCoords(hoveredFeature, main.getConfigValues().getRelativeCoords(hoveredFeature).getX()+xOffset,
                main.getConfigValues().getRelativeCoords(hoveredFeature).getY()+yOffset);
    }
}
 
Example 2
Source File: Example16_2.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	switch(key) {
		case Keyboard.KEY_SPACE:
			drawGammaProgram = !drawGammaProgram;
			drawGammaTexture = !drawGammaTexture;
			break;
		case Keyboard.KEY_A:
			drawGammaProgram = !drawGammaProgram;
			break;
		case Keyboard.KEY_G:
			drawGammaTexture = !drawGammaTexture;
			break;
		case Keyboard.KEY_Y:
			drawCorridor = !drawCorridor;
			break;
		case Keyboard.KEY_P:
			camTimer.togglePause();
			break;
	}
	
	System.out.println("----");
	System.out.printf("Rendering:\t\t%s\n", drawGammaProgram ? "Gamma" : "Linear");
	System.out.printf("Mipmap Generation:\t%s\n", drawGammaTexture ? "Gamma" : "Linear");
	
	if(c >= '1' && c <= '9') {
		int number = c - '1';
		if(number < NUM_SAMPLERS)
			currSampler = number;
	}
}
 
Example 3
Source File: GuiOreMappingSatellite.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
protected void keyTyped(char c, int i) throws IOException {
	if(i == Keyboard.KEY_W) {
		zCenter -= radius;
		runMapperWithSelection();
	}
	else if(i == Keyboard.KEY_S) {
		zCenter += radius;

		runMapperWithSelection();
	}
	else if(i == Keyboard.KEY_A) {
		xCenter -= radius;

		runMapperWithSelection();
	}
	else if(i == Keyboard.KEY_D) {
		xCenter += radius;

		runMapperWithSelection();
	}
	else if(i == Keyboard.KEY_DOWN){
		scanSize = Math.min(scanSize*2, maxZoom);

		runMapperWithSelection();
	}
	else if(i == Keyboard.KEY_UP) {
		if((scanSize/2)/radius > 0) {
			scanSize = Math.max(scanSize/2, 2);

			runMapperWithSelection();
		}
	}
	//TODO: fix radius
	/*else if(i == Keyboard.KEY_LEFT) {
		radius = Math.max(radius / 2, 1);

		currentMapping.interrupt();
		resetTexture();
		currentMapping = new Thread(mapper);
		currentMapping.start();
	} else if(i == Keyboard.KEY_RIGHT) {
		if(scanSize/(radius*2) > 0) {
			radius = Math.min(radius*2, MAXRADIUS);
			currentMapping.interrupt();
			resetTexture();
			currentMapping = new Thread(mapper);
			currentMapping.start();
		}
	}*/
	else 
		super.keyTyped(c, i);
}
 
Example 4
Source File: ActionButtonPanel.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
public final boolean doKeyPressed(KeyboardEvent event) {
	switch (event.getKeyCode()) {
		case Keyboard.KEY_M:
		case Keyboard.KEY_Q:
			if (current_unit)
				return true;
			break;
		case Keyboard.KEY_A:
			if ((current_unit || current_armory || current_tower) && !event.isControlDown())
				return true;
			break;
		case Keyboard.KEY_P:
			if (current_quarters)
				return true;
			if (current_unit)
				break;
		case Keyboard.KEY_G:
		case Keyboard.KEY_T:
			if (current_unit || current_armory)
				return true;
		case Keyboard.KEY_C:
		case Keyboard.KEY_I:
		case Keyboard.KEY_W:
		case Keyboard.KEY_ESCAPE:
			if (current_armory)
				if (current_submenu == harvest_group ||
						current_submenu == build_group ||
						current_submenu == army_group ||
						current_submenu == transport_group)
					return true;
			break;
		case Keyboard.KEY_R:
			if (current_armory || current_quarters)
				return true;
			break;
		case Keyboard.KEY_X:
			if (current_tower)
				return true;
			break;
		default:
			break;
	}
	return false;
}