当前位置: 首页>>代码示例>>Java>>正文


Java Keyboard.KEY_DOWN属性代码示例

本文整理汇总了Java中org.lwjgl.input.Keyboard.KEY_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java Keyboard.KEY_DOWN属性的具体用法?Java Keyboard.KEY_DOWN怎么用?Java Keyboard.KEY_DOWN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.lwjgl.input.Keyboard的用法示例。


在下文中一共展示了Keyboard.KEY_DOWN属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
  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

示例6: 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

示例7: 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

示例8: 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_DOWN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。