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

The following examples show how to use org.lwjgl.input.Keyboard#KEY_3 . 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: SelectionDelegate.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
public final void keyPressed(KeyboardEvent event) {
	getCamera().keyPressed(event);
	int army_number = 0;
	switch (event.getKeyCode()) {
		case Keyboard.KEY_SPACE:
		case Keyboard.KEY_NUMPAD5:
			if (!map_mode) {
				selection = false;
				getViewer().getPicker().pickRotate((GameCamera)getCamera());
				map_mode = true;
				if (observer)
					observer_label.remove();
				else
					getActionButtonPanel().remove();
				getCamera().disable();
				setCamera(new MapCamera(this, game_camera));
				getCamera().enable();
			}
			break;
		case Keyboard.KEY_TAB:
			if (!observer) {
				Notification n = getViewer().getNotificationManager().getLatestNotification();
				if (n != null) {
					if (getCamera() instanceof GameCamera)
						getGUIRoot().pushDelegate(new JumpDelegate(getViewer(), (GameCamera)getCamera(), n.getX(), n.getY()));
					else if (getCamera() instanceof MapCamera)
						((MapCamera)getCamera()).mapGoto(n.getX(), n.getY(), true);
				}
			}
			break;
		case Keyboard.KEY_9: army_number++;
		case Keyboard.KEY_8: army_number++;
		case Keyboard.KEY_7: army_number++;
		case Keyboard.KEY_6: army_number++;
		case Keyboard.KEY_5: army_number++;
		case Keyboard.KEY_4: army_number++;
		case Keyboard.KEY_3: army_number++;
		case Keyboard.KEY_2: army_number++;
		case Keyboard.KEY_1: army_number++;
		case Keyboard.KEY_0:
			if (!map_mode && !observer) {
				if (event.isControlDown()) {
					getViewer().getSelection().setShortcutArmy(army_number);
				} else {
					boolean selected = getViewer().getSelection().enableShortcutArmy(army_number);
					if (selected && event.getNumClicks() > 1) {
						Set set = getViewer().getSelection().getCurrentSelection().getSet();
						if (set.size() > 0) {
							Selectable s = (Selectable)set.iterator().next();
							getGUIRoot().pushDelegate(new JumpDelegate(getViewer(), (GameCamera)getCamera(), s.getPositionX(), s.getPositionY()));
						}
					}
				}
			}
			break;
		case Keyboard.KEY_RETURN:
				if (!chat_visible)
					chat_form.setReceivers(!event.isShiftDown());
			break;
		case Keyboard.KEY_B:
			if (event.isControlDown() && !map_mode && !observer) {
				getGUIRoot().pushDelegate(new BeaconDelegate(getViewer(), (GameCamera)getCamera()));
			}
			break;
		case Keyboard.KEY_N:
			nextIdlePeon();
			break;
		case Keyboard.KEY_F:
		case Keyboard.KEY_Z:
			if (!map_mode)
				super.keyPressed(event);
			break;
		default:
			if (map_mode || observer) {
				super.keyPressed(event);
			} else {
				if (!getActionButtonPanel().doKeyPressed(event))
					super.keyPressed(event);
			}
			break;
	}
}
 
Example 2
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 3
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 4
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 5
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;
	}
}