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

The following examples show how to use org.lwjgl.input.Keyboard#KEY_H . 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: Example10_2.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	switch(key) {
		case Keyboard.KEY_SPACE:
			drawColoredCyl = !drawColoredCyl;
			break;
		case Keyboard.KEY_Y:
			drawLight = !drawLight;
			break;
		case Keyboard.KEY_T:
			scaleCyl = !scaleCyl;
			break;
		case Keyboard.KEY_H:
			useFragmentLighting = !useFragmentLighting;
			break;
		case Keyboard.KEY_B:
			lightTimer.togglePause();
			break;
	}
}
 
Example 2
Source File: ClientEventHandler.java    From HoloInventory with MIT License 5 votes vote down vote up
public static void init()
{
    if (instance != null) MinecraftForge.EVENT_BUS.unregister(instance);
    instance = new ClientEventHandler();
    MinecraftForge.EVENT_BUS.register(new ClientEventHandler());

    keyHold = new KeyBinding("Hold to show", KeyConflictContext.IN_GAME, Keyboard.KEY_H, HoloInventory.MODID);
    keyToggle = new KeyBinding("Toggle to show", KeyConflictContext.IN_GAME, 0, HoloInventory.MODID);
    ClientRegistry.registerKeyBinding(keyHold);
    ClientRegistry.registerKeyBinding(keyToggle);
}
 
Example 3
Source File: NamesKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public NamesKeybind() {
    super("Name History", Keyboard.KEY_H);
}
 
Example 4
Source File: Form.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
protected final void keyPressed(KeyboardEvent event) {
	if (event.getKeyCode() == Keyboard.KEY_H && event.isControlDown())
		super.keyPressed(event);
}
 
Example 5
Source File: Example17_2.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	switch(key) {
		case Keyboard.KEY_SPACE:
			lightViewPole.reset();
			break;
		case Keyboard.KEY_T:
			drawCameraPos = !drawCameraPos;
			break;
		case Keyboard.KEY_G:
			showOtherLights = !showOtherLights;
			break;
		case Keyboard.KEY_H:
			currSampler = (currSampler + 1) % NUM_SAMPLERS;
			break;
		case Keyboard.KEY_P:
			timer.togglePause();
			break;
		case Keyboard.KEY_Y:
			currFOVIndex = Math.min(currFOVIndex + 1, lightFOVS.length - 1);
			System.out.println("Curr FOV: " + lightFOVS[currFOVIndex]);
			break;
		case Keyboard.KEY_N:
			currFOVIndex = Math.max(currFOVIndex - 1, 0);
			System.out.println("Curr FOV: " + lightFOVS[currFOVIndex]);
			break;
		case Keyboard.KEY_RETURN:
			try {
				loadAndSetupScene();
			} catch(Exception exc) {
				exc.printStackTrace();
				destroy();
			}
			break;
	}
	
	int posibleIndex = c - '1';
	if(posibleIndex >= 0 && posibleIndex < NUM_LIGHT_TEXTURES) {
		currTextureIndex = posibleIndex;
		System.out.println(texDefs[currTextureIndex][1]);
	}
}
 
Example 6
Source File: Example10_3.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	boolean changedAtten = false;
	
	switch(key) {
		case Keyboard.KEY_SPACE:
			drawColoredCyl = !drawColoredCyl;
			break;
		case Keyboard.KEY_O:
			lightAttenuation *= Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ? 1.1f : 1.5f;
			changedAtten = true;
			break;
		case Keyboard.KEY_U:
			lightAttenuation /= Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ? 1.1f : 1.5f;
			changedAtten = true;
			break;
		case Keyboard.KEY_Y:
			drawLight = !drawLight;
			break;
		case Keyboard.KEY_T:
			scaleCyl = !scaleCyl;
			break;
		case Keyboard.KEY_H:
			useRSquare = !useRSquare;
			if(useRSquare)
				System.out.println("Inverse Squared Attenuation");
			else
				System.out.println("Plain Inverse Attenuation");
			
			break;
		case Keyboard.KEY_B:
			lightTimer.togglePause();
			break;
	}
	
	if(lightAttenuation < 0.1f)
		lightAttenuation = 0.1f;
	
	if(changedAtten)
		System.out.println("Atten: " + lightAttenuation);
}
 
Example 7
Source File: Example13_1.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	switch(key) {
		case Keyboard.KEY_P:
			sphereTimer.togglePause();
			break;
		case Keyboard.KEY_MINUS:
			sphereTimer.rewind(0.5f);
			break;
		case Keyboard.KEY_EQUALS:
			sphereTimer.fastForward(0.5f);
			break;
		case Keyboard.KEY_T:
			drawCameraPos = !drawCameraPos;
			break;
		case Keyboard.KEY_G:
			drawLights = !drawLights;
			break;
		case Keyboard.KEY_1:
			drawImpostor[0] = !drawImpostor[0];
			break;
		case Keyboard.KEY_2:
			drawImpostor[1] = !drawImpostor[1];
			break;
		case Keyboard.KEY_3:
			drawImpostor[2] = !drawImpostor[2];
			break;
		case Keyboard.KEY_4:
			drawImpostor[3] = !drawImpostor[3];
			break;
		case Keyboard.KEY_L:
			currentImpostor = Impostors.BASIC;
			break;
		case Keyboard.KEY_J:
			currentImpostor = Impostors.PERSPECTIVE;
			break;
		case Keyboard.KEY_H:
			currentImpostor = Impostors.DEPTH;
			break;
	}
}
 
Example 8
Source File: Example11_3.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	boolean changedShininess = false;
	boolean changedLightModel = false;
	
	switch(key) {
		case Keyboard.KEY_SPACE:
			drawColoredCyl = !drawColoredCyl;
			break;
		case Keyboard.KEY_O:
			materialParams.increment(!(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
			changedShininess = true;
			break;
		case Keyboard.KEY_U:
			materialParams.decrement(!(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
			changedShininess = true;
			break;
		case Keyboard.KEY_Y:
			drawLightSource = !drawLightSource;
			break;
		case Keyboard.KEY_T:
			scaleCyl = !scaleCyl;
			break;
		case Keyboard.KEY_B:
			lightTimer.togglePause();
			break;
		case Keyboard.KEY_G:
			drawDark = !drawDark;
			break;
		case Keyboard.KEY_H:
			if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
				if(lightModel.ordinal() % 2 != 0)
					lightModel = LightingModel.values()[(lightModel.ordinal() - 1) % LightingModel.values().length];
				else
					lightModel = LightingModel.values()[(lightModel.ordinal() + 1) % LightingModel.values().length];
			} else
				lightModel = LightingModel.values()[(lightModel.ordinal() + 2) % LightingModel.values().length];
			
			changedLightModel = true;
			break;
	}
	
	if(changedShininess)
		System.out.printf("Shiny: %f\n", materialParams.getSpecularValue());
	
	if(changedLightModel)
		System.out.printf("%s\n", lightModel);
}
 
Example 9
Source File: Example11_1.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	boolean changedShininess = false;
	boolean changedLightModel = false;
	
	switch(key) {
		case Keyboard.KEY_SPACE:
			drawColoredCyl = !drawColoredCyl;
			break;
		case Keyboard.KEY_O:
			shininessFactor += 0.5f;
			changedShininess = true;
			break;
		case Keyboard.KEY_U:
			shininessFactor -= 0.5f;
			changedShininess = true;
			break;
		case Keyboard.KEY_Y:
			drawLightSource = !drawLightSource;
			break;
		case Keyboard.KEY_T:
			scaleCyl = !scaleCyl;
			break;
		case Keyboard.KEY_B:
			lightTimer.togglePause();
			break;
		case Keyboard.KEY_G:
			drawDark = !drawDark;
			break;
		case Keyboard.KEY_H:
			if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))
				switch(lightModel) {
					case DIFFUSE_AND_SPECULAR:
						lightModel = LightingModel.PURE_DIFFUSE;
						break;
					case PURE_DIFFUSE:
						lightModel = LightingModel.DIFFUSE_AND_SPECULAR;
						break;
					case SPECULAR_ONLY:
						lightModel = LightingModel.PURE_DIFFUSE;
						break;
				}
			else
				lightModel = LightingModel.values()[(lightModel.ordinal() + 1) % LightingModel.values().length];
			
			changedLightModel = true;
			break;
	}
	
	if(shininessFactor <= 0)
		shininessFactor = 0.0001f;
	
	if(changedShininess)
		System.out.printf("Shiny: %f\n", shininessFactor);
	
	if(changedLightModel)
		System.out.printf("%s\n", lightModel.name());
}
 
Example 10
Source File: Example11_2.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	boolean changedShininess = false;
	boolean changedLightModel = false;
	
	switch(key) {
		case Keyboard.KEY_SPACE:
			drawColoredCyl = !drawColoredCyl;
			break;
		case Keyboard.KEY_O:
			materialParams.increment(!(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
			changedShininess = true;
			break;
		case Keyboard.KEY_U:
			materialParams.decrement(!(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
			changedShininess = true;
			break;
		case Keyboard.KEY_Y:
			drawLightSource = !drawLightSource;
			break;
		case Keyboard.KEY_T:
			scaleCyl = !scaleCyl;
			break;
		case Keyboard.KEY_B:
			lightTimer.togglePause();
			break;
		case Keyboard.KEY_G:
			drawDark = !drawDark;
			break;
		case Keyboard.KEY_H:
			if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
				if(lightModel.ordinal() % 2 != 0)
					lightModel = LightingModel.values()[(lightModel.ordinal() - 1) % LightingModel.values().length];
				else
					lightModel = LightingModel.values()[(lightModel.ordinal() + 1) % LightingModel.values().length];
			} else
				lightModel = LightingModel.values()[(lightModel.ordinal() + 2) % LightingModel.values().length];
			
			changedLightModel = true;
			break;
	}
	
	if(changedShininess)
		System.out.printf("Shiny: %f\n", materialParams.getSpecularValue());
	
	if(changedLightModel)
		System.out.printf("%s\n", lightModel);
}
 
Example 11
Source File: Example12_3.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void keyPressed(int key, char c) {
	switch(key) {
		case Keyboard.KEY_P:
			lights.togglePause(timerMode);
			break;
		case Keyboard.KEY_MINUS:
			lights.rewindTime(timerMode, 1);
			break;
		case Keyboard.KEY_EQUALS:
			lights.fastForwardTime(timerMode, 1);
			break;
		case Keyboard.KEY_T:
			drawCameraPos = !drawCameraPos;
			break;
		case Keyboard.KEY_1:
			timerMode = TimerTypes.TIMER_ALL;
			System.out.println("All");
			break;
		case Keyboard.KEY_2:
			timerMode = TimerTypes.TIMER_SUN;
			System.out.println("Sun");
			break;
		case Keyboard.KEY_3:
			timerMode = TimerTypes.TIMER_LIGHTS;
			System.out.println("Lights");
			break;
		case Keyboard.KEY_L:
			if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))
				setupGammaLighting();
			else
				setupHDRLighting();
			break;
		case Keyboard.KEY_K:
			isGammaCorrect = !isGammaCorrect;
			if(isGammaCorrect)
				System.out.println("Gamma on!");
			else
				System.out.println("Gamma off!");
			break;
		case Keyboard.KEY_Y:
			gammaValue += 0.1f;
			System.out.println("Gamma: " + gammaValue);
			break;
		case Keyboard.KEY_H:
			gammaValue -= 0.1f;
			if(gammaValue < 1f)
				gammaValue = 1;
			System.out.println("Gamma: " + gammaValue);
			break;
		case Keyboard.KEY_SPACE:
			float sunAlpha = lights.getSunTime();
			float sunTimeHours = sunAlpha * 24 + 12;
			sunTimeHours = sunTimeHours > 24 ? sunTimeHours - 24 : sunTimeHours;
			int sunHours = (int)sunTimeHours;
			float sunTimeMinutes = (sunTimeHours - sunHours) * 60f;
			int sunMinutes = (int)sunTimeMinutes;
			System.out.println(sunHours + ":" + sunMinutes);
			break;
	}
}