本文整理匯總了Java中org.lwjgl.input.Keyboard.KEY_ESCAPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEY_ESCAPE屬性的具體用法?Java Keyboard.KEY_ESCAPE怎麽用?Java Keyboard.KEY_ESCAPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.lwjgl.input.Keyboard
的用法示例。
在下文中一共展示了Keyboard.KEY_ESCAPE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: func_146282_l
@Override
public void func_146282_l() {
if (Bit.getInstance() == null) {
return;
}
int key = Keyboard.getEventKey();
char cha = Keyboard.getEventCharacter();
if (key == Keyboard.KEY_NONE) return;
if (key == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState()) {
Wrapper.displayGuiScreen(null);
return;
}
if (key == Keyboard.KEY_F11) Wrapper.getMinecraft().func_71352_k();
Iterator<Window> iter = Bit.getInstance().getClickGui().getWindows().iterator();
while (iter.hasNext()) {
Window comp = iter.next();
if (Keyboard.getEventKeyState())
comp.keyPress(key, cha);
else
comp.keyRelease(key, cha);
}
}
示例2: keyPress
@Override
public void keyPress(int key, char keyChar) {
if (this.extended)
this.componentList.keyPress(key, keyChar);
if (this.binding) {
if (key != Keyboard.KEY_NONE && key != Keyboard.KEY_ESCAPE && key != Keyboard.KEY_LSHIFT && key != Keyboard.KEY_GRAVE && key != Keyboard.KEY_RSHIFT) {
this.mod.setKeybind(key);
new Thread(() -> {
if (this.title == null || mod == null) return;
this.title = "Bound to " + Keyboard.getKeyName(key);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
}
if (this.title == null || mod == null) return;
this.title = mod.getId();
}).start();
this.binding = false;
}
}
}
示例3: 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();
}
}
示例4: keyTyped
@Override
protected void keyTyped(char c, int key) throws IOException {
if (Widget.getFocused() == null) {
if (key == Keyboard.KEY_ESCAPE || !justOpened && key == menuKey && key != Keyboard.KEY_NONE) {
super.keyTyped(c, Keyboard.KEY_ESCAPE);
} else if (key == Keyboard.KEY_DELETE) {
Widget widget = Widget.getHovered();
if (isElement(widget)) {
widget.setActivated(true);
widget.setValue(null);
}
}
} else {
Widget.getFocused().keyTyped(c, key);
}
}
示例5: onKey
@Override
public void onKey(KeyEvent e){
Gui openGui=guiHandler.getOpenGui();
if(openGui==null){
if(e.code==Keyboard.KEY_ESCAPE){
if(e.action==KeyAction.RELEASE) guiHandler.openGui(new GuiPause());
}
return;
}
openGui.onKey(e);
}
示例6: keyTyped
@Override
protected void keyTyped(char par1, int par2) throws IOException
{
if(par2 == Keyboard.KEY_ESCAPE)
controller.close();
else
super.keyTyped(par1, par2);
}
示例7: keyTyped
@Override
protected void keyTyped(char par1, int par2) throws IOException
{
controller.handleMinecraftKey(par2);
if (par2 != Keyboard.KEY_ESCAPE)
super.keyTyped(par1, par2);
}
示例8: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
if (keyCode == Keyboard.KEY_BACK) {
if (!text.isEmpty() && cursor > 0) {
text = text.substring(0, cursor-1) + text.substring(cursor);
cursor--;
}
} else if (keyCode == Keyboard.KEY_DELETE) {
if (cursor < text.length()) {
text = text.substring(0, cursor) + text.substring(cursor+1);
}
} else if (keyCode == Keyboard.KEY_HOME) {
cursor = 0;
} else if (keyCode == Keyboard.KEY_END) {
cursor = text.length();
} else if (keyCode == Keyboard.KEY_LEFT) {
if (cursor > 0) {
cursor--;
}
} else if (keyCode == Keyboard.KEY_RIGHT) {
if (cursor < text.length()) {
cursor++;
}
} else if (keyCode == Keyboard.KEY_ESCAPE) {
close();
} else if (keyCode == Keyboard.KEY_RETURN) {
destination = new TeleportDestination(text, destination.getDimension(), destination.getPos(), destination.getSide());
MeeCreepsMessages.INSTANCE.sendToServer(new PacketSetDestination(destination, destinationIndex));
close();
} else if (typedChar != 0) {
if (text.length() < 15) {
text = text.substring(0, cursor) + typedChar + text.substring(cursor);
cursor++;
}
}
}
示例9: keyTyped
public void keyTyped(char typedChar, int keyCode) throws IOException {
if (isActive) {
switch (keyCode) {
case Keyboard.KEY_ESCAPE:
isActive = false;
break;
case Keyboard.KEY_RETURN:
isActive = false;
//setValue(input);
MC.player.sendMessage(new TextComponentString(input.toString()));
break;
case Keyboard.KEY_BACK:
if (selectedIndex > -1) {
input.deleteCharAt(selectedIndex);
selectedIndex--;
}
break;
case Keyboard.KEY_LEFT:
selectedIndex--;
break;
case Keyboard.KEY_RIGHT:
selectedIndex++;
break;
default:
if (isValidChar(typedChar)) {
selectedIndex++;
input.insert(selectedIndex, typedChar);
}
}
selectedIndex = MathHelper.clamp(selectedIndex, -1, input.length()-1);
}
}
示例10: processDialogKey
public void processDialogKey(int keyCode, char keyChar, boolean Event)
{
if (Event == true && keyCode == Keyboard.KEY_ESCAPE)
DialogOpen = false;
switch (DialogID)
{
case dialogSwitchTeam:
break;
case dialogLeaveGame:
if (Event == true)
{
if (keyCode == Keyboard.KEY_RETURN
|| keyCode == Keyboard.KEY_Y)
{
System.err.println("Player has chosen to quit.");
game.destroy();
return;
}
else if (keyCode == Keyboard.KEY_N)
{
DialogOpen = false;
return;
}
}
break;
}
}
示例11: 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;
}
}
示例12: keyTyped
/**
* Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
* KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
*/
@Override
protected void keyTyped(char eventChar, int eventKey)
{
if (eventKey == Keyboard.KEY_ESCAPE)
this.mc.displayGuiScreen(parentScreen);
else
this.entryList.keyTyped(eventChar, eventKey);
}
示例13: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
if(keyCode == Keyboard.KEY_RETURN)
actionPerformed(editButton.enabled ? editButton : addButton);
else if(keyCode == Keyboard.KEY_ESCAPE)
actionPerformed(backButton);
}
示例14: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
valueField.textboxKeyTyped(typedChar, keyCode);
if(keyCode == Keyboard.KEY_RETURN)
actionPerformed(doneButton);
else if(keyCode == Keyboard.KEY_ESCAPE)
mc.displayGuiScreen(prevScreen);
}
示例15: keyTyped
@Override
public void keyTyped(char c, int key) {
if (!hasFocus()) return;
if (key == Keyboard.KEY_ESCAPE) {
setFocused(false);
} else if (key != Keyboard.KEY_NONE) {
setValue(new KeyBind(key));
setFocused(false);
}
}