本文整理汇总了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);
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
}
}