當前位置: 首頁>>代碼示例>>Java>>正文


Java Keyboard.KEY_UP屬性代碼示例

本文整理匯總了Java中org.lwjgl.input.Keyboard.KEY_UP屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEY_UP屬性的具體用法?Java Keyboard.KEY_UP怎麽用?Java Keyboard.KEY_UP使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.lwjgl.input.Keyboard的用法示例。


在下文中一共展示了Keyboard.KEY_UP屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: keyTyped

@Override
protected void keyTyped(char par1, int par2) throws IOException
{
	switch(par2)
	{
	case Keyboard.KEY_LEFT:
		horizontalPan -= 3;
		break;
	case Keyboard.KEY_RIGHT:
		horizontalPan += 3;
		break;
	case Keyboard.KEY_UP:
		verticalPan -= 3;
		break;
	case Keyboard.KEY_DOWN:
		verticalPan += 3;
		break;	
	}
	super.keyTyped(par1, par2);
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:20,代碼來源:GuiEntityRenderer.java

示例2: keyTyped

@Override
public void keyTyped(IGuiBase gui, char typedChar, int keycode){
	super.keyTyped(gui, typedChar, keycode);
	if (keycode == Keyboard.KEY_UP && key == Key.UP_ARROW
			|| keycode == Keyboard.KEY_DOWN && key == Key.DOWN_ARROW
			|| keycode == Keyboard.KEY_RIGHT && key == Key.RIGHT_ARROW
			|| keycode == Keyboard.KEY_LEFT && key == Key.LEFT_ARROW){
		if (x >= 40 && x <= 56 && !struck){
			struck = true;
			if (gui instanceof GuiLearnSpell && incProgress){
				((GuiLearnSpell)gui).incrementProgress();
			}
			for (int i = 0; i < 20; i ++){
				gui.getObjectList().add(new GuiObjectParticle(48.0,y,1.0f*(random.nextFloat()-0.5f),1.0f*(random.nextFloat()-0.5f),0.5f,0.75f,1.0f,1.0f,8,80));
			}
			deathtime = 20;
		}
	}
}
 
開發者ID:TeamMelodium,項目名稱:Melodium,代碼行數:19,代碼來源:GuiObjectNote.java

示例3: onKeyPress

public void onKeyPress(int keyCode)
{
	switch(keyCode)
	{
		case Keyboard.KEY_DOWN:
		if(selected < features.size() - 1)
			selected++;
		else
			selected = 0;
		break;
		
		case Keyboard.KEY_UP:
		if(selected > 0)
			selected--;
		else
			selected = features.size() - 1;
		break;
		
		case Keyboard.KEY_RETURN:
		features.get(selected).doPrimaryAction();
		break;
	}
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:23,代碼來源:TabGui.java

示例4: onKey

@EventTarget
public void onKey(EventKeyboard e) {
	switch (e.getKey()) {
	case Keyboard.KEY_UP:
		this.up();
		break;
	case Keyboard.KEY_DOWN:
		this.down();
		break;
	case Keyboard.KEY_RIGHT:
		this.right(Keyboard.KEY_RIGHT);
		break;
	case Keyboard.KEY_LEFT:
		this.left();
		break;
	case Keyboard.KEY_RETURN:
		this.right(Keyboard.KEY_RETURN);
		break;
	}
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:TabGUI.java

示例5: keyTyped

@Override
protected void keyTyped(char character, int key) {
	
	if (key == Keyboard.KEY_ESCAPE)
		mc.displayGuiScreen(null);
	if (key == Keyboard.KEY_RIGHT && this.next.visible) {
		this.pageIndex++;
		this.savedIndex = pageIndex;
		NBTUtils.setInt(book, "savedIndex", savedIndex);
		updateButtons();
	}
	if (key == Keyboard.KEY_LEFT && this.prev.visible) {
		this.pageIndex--;
		this.savedIndex = pageIndex;
		NBTUtils.setInt(book, "savedIndex", savedIndex);
		updateButtons();
	}
	if (key == Keyboard.KEY_UP && this.backbutton.visible) {
		this.pageIndex = 2;
		this.savedIndex = pageIndex;
		NBTUtils.setInt(book, "savedIndex", savedIndex);
		updateButtons();
	}
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:24,代碼來源:GuiBookGuide.java

示例6: keyPress

@Override
public void keyPress(int key, char keyChar) {
    if (!focus) return;
    if (key == Keyboard.KEY_RETURN) {
        if (text.replaceAll(" ", "") == "") return;
        String[] arr = text.split(" ");
        String command = arr[0];
        String[] args = Arrays.copyOfRange(arr, 1, arr.length);
        Bit.getInstance().getCommandManager().processCommand(command, args);
        Bit.getInstance().nullString(lastCommand);
        lastCommand = text;
        Bit.getInstance().nullString(text);
        text = "";
        return;
    } else if (key == Keyboard.KEY_BACK) {
        if (text.length() - 1 >= 0) text = text.substring(0, text.length() - 1);
        return;
    } else if (lastCommand != null && !lastCommand.equals("") && key == Keyboard.KEY_UP) {
        text = lastCommand;
        return;
    }

    if (Wrapper.getStringWidth_scaled(text, 0.5) > this.getSize().getX() - 9) return;
    String keyName = String.valueOf(keyChar);
    if (keyName.length() != 1) return;
    if (Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK)) keyName = keyName.toUpperCase();
    text += keyName;
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:28,代碼來源:ConsoleComponent.java

示例7: keyTyped

@Override
  public void keyTyped(char c, int key)
  {
if (c >= '0' && c <= '9')
{
	amount = amount.concat("" + c);
}
if (key == Keyboard.KEY_BACK && amount != null && !amount.isEmpty()) {
	amount = amount.substring(0, amount.length() - 1);
}
if (key == Keyboard.KEY_RETURN) {
	AccountCapability cap = player.getCapability(Currency.ACCOUNT_DATA, null);
	if (amount != null && !amount.isEmpty() && Float.parseFloat(amount) <= 25000) {
		if (!deposit.enabled) {
			cap.addClientAmount(Float.parseFloat(amount), true);
			CurrencyUtils.depositMoney(player, Float.parseFloat(amount));
		} else if (!withdraw.enabled && Float.parseFloat(amount) <= cap.getAmount()) {
			cap.subtractClientAmount(Float.parseFloat(amount), true);
			PacketDispatcher.sendToServer(new MessageSyncDrops(player, Float.parseFloat(amount)));
		}
	}
	this.mc.displayGuiScreen((GuiScreen)null);
}
if (key == Keyboard.KEY_E || key == Keyboard.KEY_ESCAPE) {
	this.mc.displayGuiScreen((GuiScreen)null);
}
if (key == Keyboard.KEY_UP || key == Keyboard.KEY_DOWN) {
	withdraw.enabled = !withdraw.enabled;
	deposit.enabled = !deposit.enabled;
}
  }
 
開發者ID:Zundrel,項目名稱:Never-Enough-Currency,代碼行數:31,代碼來源:GuiATM.java

示例8: keyUp

@Override
public void keyUp(int keycode)
{
    if (keycode == Keyboard.KEY_W || keycode == Keyboard.KEY_UP)
        setSelected(selected - 1);
    if (keycode == Keyboard.KEY_S || keycode == Keyboard.KEY_DOWN)
        setSelected(selected + 1);
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:8,代碼來源:GuiIfTabletSESelector.java

示例9: keyTyped

@Override
protected void keyTyped(char par1, int par2) throws IOException {
    if (par2 == Keyboard.KEY_ESCAPE) {
        NetworkHandler.sendToServer(new PacketAphorismTileUpdate(tile));
    } else if (par2 == Keyboard.KEY_LEFT || par2 == Keyboard.KEY_UP) {
        cursorY--;
        if (cursorY < 0) cursorY = textLines.length - 1;
    } else if (par2 == Keyboard.KEY_DOWN || par2 == Keyboard.KEY_NUMPADENTER) {
        cursorY++;
        if (cursorY >= textLines.length) cursorY = 0;
    } else if (par2 == Keyboard.KEY_RETURN) {
        cursorY++;
        textLines = ArrayUtils.add(textLines, cursorY, "");
    } else if (par2 == Keyboard.KEY_BACK) {
        if (textLines[cursorY].length() > 0) {
            textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
            if (textLines[cursorY].endsWith("\u00a7")) {
                textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
            }
        } else if (textLines.length > 1) {
            textLines = ArrayUtils.remove(textLines, cursorY);
            cursorY--;
            if (cursorY < 0) cursorY = 0;
        }
    } else if (par2 == Keyboard.KEY_DELETE) {
        if (GuiScreen.isShiftKeyDown()) {
            textLines = new String[1];
            textLines[0] = "";
            cursorY = 0;
        } else {
            if (textLines.length > 1) {
                textLines = ArrayUtils.remove(textLines, cursorY);
                if (cursorY > textLines.length - 1)
                    cursorY = textLines.length - 1;
            }
        }
    } else if (ChatAllowedCharacters.isAllowedCharacter(par1)) {
        if (GuiScreen.isAltKeyDown()) {
            if (par1 >= 'a' && par1 <= 'f' || par1 >= 'l' && par1 <= 'o' || par1 == 'r' || par1 >= '0' && par1 <= '9') {
                textLines[cursorY] = textLines[cursorY] + "\u00a7" + par1;
            }
        } else {
            textLines[cursorY] = textLines[cursorY] + par1;
        }
    }
    tile.setTextLines(textLines);
    super.keyTyped(par1, par2);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:48,代碼來源:GuiAphorismTile.java

示例10: input

private void input() {
	if (mouseEnabled || Mouse.isButtonDown(0)) {
		mouseEnabled = true;
		int mousex = Mouse.getX();
		int mousey = 480 - Mouse.getY() - 1;
		boolean mouseClicked = Mouse.isButtonDown(0);
		selector_x = Math.round(mousex / World.BLOCK_SIZE);
		selector_y = Math.round(mousey / World.BLOCK_SIZE);
		if (mouseClicked) {
			grid.setAt(selector_x, selector_y, selection);
		}
	}
	
	while (Keyboard.next()) {
		if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT && Keyboard.getEventKeyState()) {
			if (!(selector_x + 1 > World.BLOCKS_WIDTH - 2)) {
				mouseEnabled = false;
				selector_x++;
			}
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_LEFT && Keyboard.getEventKeyState()) {
			if (!(selector_x - 1 < 0)) {
				mouseEnabled = false;
				selector_x--;
			}
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_UP && Keyboard.getEventKeyState()) {
			if (!(selector_y - 1 < 0)) {
				mouseEnabled = false;
				selector_y--;
			}
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_DOWN && Keyboard.getEventKeyState()) {
			if (!(selector_y + 1 > World.BLOCKS_HEIGHT - 2)) {
				mouseEnabled = false;
				selector_y++;
			}
		}
		
		if (Keyboard.getEventKey() == Keyboard.KEY_S) {
			grid.save(new File("save.xml"));
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_L) {
			grid.load(new File("save.xml"));
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_1) {
			selection = BlockType.STONE;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_2) {
			selection = BlockType.DIRT;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_3) {
			selection = BlockType.GRASS;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_4) {
			selection = BlockType.AIR;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_C) {
			grid.clear();
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_SPACE) {
			grid.setAt(selector_x, selector_y, selection);
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
			Display.destroy();
			System.exit(0);
		}
	}
}
 
開發者ID:nitrodragon,項目名稱:lwjgl_collection,代碼行數:69,代碼來源:Boot.java


注:本文中的org.lwjgl.input.Keyboard.KEY_UP屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。