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

The following examples show how to use org.lwjgl.input.Keyboard#KEY_Z . 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: ControllableCameraDelegate.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public void keyPressed(KeyboardEvent event) {
	switch (event.getKeyCode()) {
		case Keyboard.KEY_F:
			pushFirstPersonDelegate(true);
			break;
		case Keyboard.KEY_Z:
			pushZoomDelegate();
			break;
		default:
			super.keyPressed(event);
			break;
	}
}
 
Example 2
Source File: ZoomDelegate.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public void keyReleased(KeyboardEvent event) {
	if (!done) {
		switch (event.getKeyCode()) {
			case Keyboard.KEY_Z:
				pop();
				break;
		}
	}
}
 
Example 3
Source File: ConfirmationMessage.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public void beginStep(){
	List<KeyboardEvent> keys = Game.getKeys();
	if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) {
		repeatTimers[2] = 0.12f;
		yesHover = !yesHover;
		AudioPlayer.playAudio("cursor2", 1, 1);
	}
	if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) {
		repeatTimers[3] = 0.12f;
		yesHover = !yesHover;
		AudioPlayer.playAudio("cursor2", 1, 1);
	}
	for(KeyboardEvent ke : keys) {
		if(ke.state) {
			if(ke.key == Keyboard.KEY_RETURN || ke.key == Keyboard.KEY_Z) { 
				AudioPlayer.playAudio("select", 1, 1);
				if(yesHover)
					confirm();
				else 
					cancel();
				destroy();
			} if(ke.key == Keyboard.KEY_X){
				AudioPlayer.playAudio("cancel", 1, 1);
				cancel();
				destroy();
			}
		}
	}
	for(int i=0; i<repeatTimers.length; i++) {
		if(repeatTimers[i] > 0) {
			repeatTimers[i] -= Game.getDeltaSeconds();
			if(repeatTimers[i] < 0) repeatTimers[i] = 0;
		}
	}
}
 
Example 4
Source File: GuiProgrammer.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void keyTyped(char key, int keyCode){
    super.keyTyped(key, keyCode);

    if(Keyboard.KEY_I == keyCode && Loader.isModLoaded(ModIds.IGWMOD)) {
        onIGWAction();
    }
    if(Keyboard.KEY_R == keyCode) {
        if(exportButton.getBounds().contains(lastMouseX, lastMouseY)) {
            NetworkHandler.sendToServer(new PacketGuiButton(0));
        }
    }
    if(Keyboard.KEY_SPACE == keyCode) {
        toggleShowWidgets();
    }
    if(Keyboard.KEY_DELETE == keyCode) {
        IProgWidget widget = programmerUnit.getHoveredWidget(lastMouseX, lastMouseY);
        if(widget != null) {
            te.progWidgets.remove(widget);
            NetworkHandler.sendToServer(new PacketProgrammerUpdate(te));
        }
    }
    if(Keyboard.KEY_Z == keyCode) {
        NetworkHandler.sendToServer(new PacketGuiButton(undoButton.id));
    }
    if(Keyboard.KEY_Y == keyCode) {
        NetworkHandler.sendToServer(new PacketGuiButton(redoButton.id));
    }
}
 
Example 5
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 6
Source File: ClientOverworldStage.java    From FEMultiplayer with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void beginStep() {
	super.beginStep();
	for (Entity e : entities) {
		e.beginStep();
	}
	MapAnimation.updateAll();
	if (onControl) {
		List<KeyboardEvent> keys = Game.getKeys();
		if (Keyboard.isKeyDown(Keyboard.KEY_UP) && repeatTimers[0] == 0) {
			context.onUp();
			repeatTimers[0] = 0.12f;
		}
		if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && repeatTimers[1] == 0) {
			context.onDown();
			repeatTimers[1] = 0.12f;
		}
		if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) {
			context.onLeft();
			repeatTimers[2] = 0.12f;
		}
		if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) {
			context.onRight();
			repeatTimers[3] = 0.12f;
		}
		for(KeyboardEvent ke : keys) {
			if(ke.state) {
				if(ke.key == Keyboard.KEY_Z) 
					context.onSelect();
				else if (ke.key == Keyboard.KEY_X)
					context.onCancel(); 
			}
		}
	}
	for(int i=0; i<repeatTimers.length; i++) {
		if(repeatTimers[i] > 0) {
			repeatTimers[i] -= Game.getDeltaSeconds();
			if(repeatTimers[i] < 0) repeatTimers[i] = 0;
		}
	}
	processAddStack();
	processRemoveStack();
}
 
Example 7
Source File: UnitBuilderStage.java    From FEMultiplayer with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void beginStep() {
	for (Entity e : entities) {
		e.beginStep();
	}
	processAddStack();
	processRemoveStack();
	MapAnimation.updateAll();
	List<KeyboardEvent> keys = Game.getKeys();
	if (Keyboard.isKeyDown(Keyboard.KEY_UP) && repeatTimers[0] == 0) {
		repeatTimers[0] = 0.15f;
		state.up();
		state.updateControls();
	}
	if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && repeatTimers[1] == 0) {
		repeatTimers[1] = 0.15f;
		state.down();
		state.updateControls();
	}
	if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) {
		repeatTimers[2] = 0.15f;
		state.left();
		state.updateControls();
	}
	if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) {
		repeatTimers[3] = 0.15f;
		state.right();
		state.updateControls();
	}
	for(KeyboardEvent ke : keys) {
		if(ke.state) {
			if(ke.key == Keyboard.KEY_Z) {
				state.select();
				state.updateControls();
			} else if (ke.key == Keyboard.KEY_X){
				state.cancel();
				state.updateControls();
			}
				
		}
	}

	for(int i=0; i<repeatTimers.length; i++) {
		if(repeatTimers[i] > 0) {
			repeatTimers[i] -= Game.getDeltaSeconds();
			if(repeatTimers[i] < 0) repeatTimers[i] = 0;
		}
	}
	
}
 
Example 8
Source File: TeamBuilderStage.java    From FEMultiplayer with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void beginStep() {
	boolean capture = control;
	for (Entity e : entities) {
		e.beginStep();
	}
	processAddStack();
	processRemoveStack();
	MapAnimation.updateAll();
	if(capture){
		List<KeyboardEvent> keys = Game.getKeys();
		if (Keyboard.isKeyDown(Keyboard.KEY_UP) && repeatTimers[0] == 0) {
			repeatTimers[0] = 0.15f;
			if(control)
			if(!cursor.on){
				buttons[currButton].setHover(false);
				cursor.on = true;
				cursor.index = cursor.max - 1;
				cursor.instant = true;
				controls.set("Z", "Items/Train");
			}else if(cursor.index == 0){
				cursor.on = false;
				controls.set("Z", "Select");
				buttons[currButton].setHover(true);
			} else {
				cursor.up();
			}
			AudioPlayer.playAudio("cursor2", 1, 1);
		}
		if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && repeatTimers[1] == 0) {
			repeatTimers[1] = 0.15f;
			if(!cursor.on){
				buttons[currButton].setHover(false);
				cursor.on = true;
				cursor.index = 0;
				cursor.instant = true;
				controls.set("Z", "Items/Train");
			}else if(cursor.index == cursor.max -1){
				cursor.on = false;
				controls.set("Z", "Select");
				buttons[currButton].setHover(true);
			} else {
				cursor.down();
			}
			AudioPlayer.playAudio("cursor2", 1, 1);
		}
		if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) {
			repeatTimers[2] = 0.15f;
			if(!cursor.on){
				buttons[currButton].setHover(false);
				currButton--;
				if(currButton < 0) currButton+=4;
				buttons[currButton].setHover(true);
				AudioPlayer.playAudio("cursor2", 1, 1);
			}
		}
		if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) {
			repeatTimers[3] = 0.15f;
			if(!cursor.on){
				buttons[currButton].setHover(false);
				currButton++;
				currButton%=4;
				buttons[currButton].setHover(true);
				AudioPlayer.playAudio("cursor2", 1, 1);
			}
		}
		for(KeyboardEvent ke : keys) {
			if(ke.state) {
				if(ke.key == Keyboard.KEY_Z) {
					AudioPlayer.playAudio("select", 1, 1);
					if(cursor.on){
						FEMultiplayer.setCurrentStage(new UnitBuilderStage(units.get(cursor.getIndex()), this, session));
					} else {
						buttons[currButton].setHover(false);
						buttons[currButton].execute();
					}
					
				} else if (ke.key == Keyboard.KEY_X){
					if(canEditUnits) {
						AudioPlayer.playAudio("cancel", 1, 1);
						select.refresh();
						FEMultiplayer.setCurrentStage(select);
					}
				} else if (ke.key == Keyboard.KEY_RETURN){
					AudioPlayer.playAudio("select", 1, 1);
					buttons[0].execute();
				}
					
			}
		}
	
		for(int i=0; i<repeatTimers.length; i++) {
			if(repeatTimers[i] > 0) {
				repeatTimers[i] -= Game.getDeltaSeconds();
				if(repeatTimers[i] < 0) repeatTimers[i] = 0;
			}
		}
	}
}
 
Example 9
Source File: TeamSelectionStage.java    From FEMultiplayer with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void beginStep() {
	for(Entity e: entities){
		e.beginStep();
	}

	
	
	MapAnimation.updateAll();
	List<KeyboardEvent> keys = Game.getKeys();
	if (Keyboard.isKeyDown(Keyboard.KEY_UP) && repeatTimers[0] == 0) {
		repeatTimers[0] = 0.15f;
		up();
	}
	if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && repeatTimers[1] == 0) {
		repeatTimers[1] = 0.15f;
		down();
	}
	if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) {
		repeatTimers[2] = 0.15f;
		left();
	}
	if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) {
		repeatTimers[3] = 0.15f;
		right();
	}
	for(KeyboardEvent ke : keys) {
		if(ke.state) {
			if(ke.key == Keyboard.KEY_Z) {
				cursor.select();
			} 
			if(ke.key == Keyboard.KEY_RETURN){
				AudioPlayer.playAudio("select", 1, 1);
				buttons[0].execute();
			}
		}
	}

	for(int i=0; i<repeatTimers.length; i++) {
		if(repeatTimers[i] > 0) {
			repeatTimers[i] -= Game.getDeltaSeconds();
			if(repeatTimers[i] < 0) repeatTimers[i] = 0;
		}
	}
}