Java Code Examples for org.lwjgl.input.Keyboard#KEY_U
The following examples show how to use
org.lwjgl.input.Keyboard#KEY_U .
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_3.java From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License | 4 votes |
@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 2
Source File: Example11_3.java From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License | 4 votes |
@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 3
Source File: Example11_1.java From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License | 4 votes |
@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 4
Source File: Example11_2.java From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License | 4 votes |
@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); }