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

The following examples show how to use org.lwjgl.input.Keyboard#KEY_MINUS . 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: Example13_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_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;
	}
}
 
Example 2
Source File: Example16_3.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:
			useGammaDisplay = !useGammaDisplay;
			break;
		case Keyboard.KEY_MINUS:
			lightEnv.rewindTime(1);
			break;
		case Keyboard.KEY_EQUALS:
			lightEnv.fastForwardTime(1);
			break;
		case Keyboard.KEY_T:
			drawCameraPos = !drawCameraPos;
			break;
		case Keyboard.KEY_P:
			lightEnv.togglePause();
			break;
	}
	
	if(c >= '1' && c <= '9') {
		int number = c - '1';
		if(number < NUM_SAMPLERS)
			currSampler = number;
	}
}
 
Example 3
Source File: Example14_1.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:
			useTexture = !useTexture;
			if(useTexture)
				System.out.println("Texture");
			else
				System.out.println("Shader");
			break;
		case Keyboard.KEY_P:
			lightTimer.togglePause();
			break;
		case Keyboard.KEY_MINUS:
			lightTimer.rewind(0.5f);
			break;
		case Keyboard.KEY_EQUALS:
			lightTimer.fastForward(0.5f);
			break;
		case Keyboard.KEY_T:
			drawCameraPos = !drawCameraPos;
			break;
		case Keyboard.KEY_G:
			drawLights = !drawLights;
			break;
	}
	
	if(c >= '1' && c <= '9') {
		int number = c - '1';
		if(number < NUM_GAUSS_TEXTURES) {
			System.out.println("Angle resolution: " + calcCosAngResolution(number));
			currTexture = number;
		}
	}
}
 
Example 4
Source File: AbstractKey.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Get the name of the key being set for CustomKey
 *
 * @param keyCode opengl name of the key being pressed
 * @return the name of the key
 */
protected String getKeyOrMouseName(int keyCode) {
    if (keyCode < 0) {
        String openGLName = Mouse.getButtonName(keyCode + 100);
        if (openGLName != null) {
            if (openGLName.equalsIgnoreCase("button0")) return "LMB";
            if (openGLName.equalsIgnoreCase("button1")) return "RMB";
        }

        return openGLName;
    }

    if (mod.getSettings().isUsingLiteralKeys()) {
        switch (keyCode) {
            case Keyboard.KEY_GRAVE:
                return "~";
            case Keyboard.KEY_MINUS:
            case Keyboard.KEY_SUBTRACT:
                return "-";
            case Keyboard.KEY_APOSTROPHE:
                return "'";
            case Keyboard.KEY_LBRACKET:
                return "[";
            case Keyboard.KEY_RBRACKET:
                return "]";
            case Keyboard.KEY_BACKSLASH:
                return "\\";
            case Keyboard.KEY_DIVIDE:
            case Keyboard.KEY_SLASH:
                return "/";
            case Keyboard.KEY_COMMA:
                return ",";
            case Keyboard.KEY_PERIOD:
                return ".";
            case Keyboard.KEY_SEMICOLON:
                return ";";
            case Keyboard.KEY_EQUALS:
                return "=";
            case Keyboard.KEY_UP:
                return "▲";
            case Keyboard.KEY_DOWN:
                return "▼";
            case Keyboard.KEY_LEFT:
                return "◀";
            case Keyboard.KEY_RIGHT:
                return "▶";
            case Keyboard.KEY_MULTIPLY:
                return "*";
            case Keyboard.KEY_ADD:
                return "+";
        }
    }

    return Keyboard.getKeyName(keyCode);
}
 
Example 5
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 6
Source File: Example14_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) {
	final String[] shaderModeNames = {
			"Fixed Shininess with Gaussian Texture",
			"Texture shininess with Gaussian Texture",
			"Texture Shininess with computed Gaussian"
	};
	
	switch(key) {
		case Keyboard.KEY_SPACE:
			mode = ShaderMode.values()[(mode.ordinal() + 1) % ShaderMode.length];
			System.out.println(shaderModeNames[mode.ordinal()]);
			break;
		case Keyboard.KEY_P:
			lightTimer.togglePause();
			break;
		case Keyboard.KEY_MINUS:
			lightTimer.rewind(0.5f);
			break;
		case Keyboard.KEY_EQUALS:
			lightTimer.fastForward(0.5f);
			break;
		case Keyboard.KEY_T:
			drawCameraPos = !drawCameraPos;
			break;
		case Keyboard.KEY_G:
			drawLights = !drawLights;
			break;
		case Keyboard.KEY_Y:
			useInfinity = !useInfinity;
			break;
	}
	
	if(c >= '1' && c <= '9') {
		int number = c - '1';
		if(number < NUM_GAUSS_TEXTURES) {
			System.out.println("Angle resolution: " + calcCosAngResolution(number));
			currentTexture = number;
		}
		
		if(number >= 9 - NUMBER_OF_MATERIALS) {
			number -= 9 - NUMBER_OF_MATERIALS;
			System.out.println("Material Number: " + number);
			currentMaterial = number;
		}
	}
}
 
Example 7
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;
	}
}
 
Example 8
Source File: Example12_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:
			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))
				setupNighttimeLighting();
			else
				setupDaytimeLighting();
			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;
	}
}
 
Example 9
Source File: Example12_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_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))
				setupNighttimeLighting();
			else
				setupDaytimeLighting();
			break;
		case Keyboard.KEY_K:
			setupHDRLighting();
			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;
	}
}