本文整理匯總了Java中org.lwjgl.input.Keyboard.KEY_SPACE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEY_SPACE屬性的具體用法?Java Keyboard.KEY_SPACE怎麽用?Java Keyboard.KEY_SPACE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.lwjgl.input.Keyboard
的用法示例。
在下文中一共展示了Keyboard.KEY_SPACE屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: keyTyped
@Override
protected void keyTyped(char key, int keyCode) throws IOException {
super.keyTyped(key, keyCode);
if (nameField.isFocused()) {
return;
}
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));
}
}
示例2: mapKeyChar
public static char mapKeyChar()
{
switch(Keyboard.getEventKey())
{
case Keyboard.KEY_SPACE: return ' ';
default: return Keyboard.getEventCharacter();
}
}
示例3: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
if (isKeyDown(KeyBindings.keyOpenWheel)) {
closeThis();
} else if (keyCode == Keyboard.KEY_SPACE) {
page++;
if (page >= pages) {
page = 0;
}
} else if ((typedChar >= 'a' && typedChar <= 'z') || (typedChar >= 'A' && typedChar <= 'Z')) {
PlayerWheelConfiguration config = PlayerProperties.getWheelConfig(MinecraftTools.getPlayer(mc));
Map<String, Integer> hotkeys = config.getHotkeys();
List<String> actions = getActions();
for (String action : actions) {
if (hotkeys.containsKey(action)) {
if (hotkeys.get(action) == keyCode) {
performAction(action);
this.mc.displayGuiScreen(null);
mc.setIngameFocus();
KeyBinding.unPressAllKeys();
return;
}
}
}
}
}
示例4: input
private void input() {
int mousex = Mouse.getX();
int mousey = 480 - Mouse.getY() - 1;
boolean mouseClicked = Mouse.isButtonDown(0);
if (mouseClicked) {
int grid_x = Math.round(mousex / World.BLOCK_SIZE);
int grid_y = Math.round(mousey / World.BLOCK_SIZE);
bt = getBT(bt);
grid.setAt(grid_x, grid_y, bt);
}
while (Keyboard.next()) {
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_SPACE) {
if (bt == DIRT) {
setBT(GRASS);
} else if (bt == GRASS) {
setBT(STONE);
} else if (bt == STONE) {
setBT(AIR);
} else if (bt == AIR) {
setBT(DIRT);
}
}
}
}
示例5: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
if (keyCode == Keyboard.KEY_SPACE || keyCode == Keyboard.KEY_RIGHT) {
pageInc();
} else if (keyCode == Keyboard.KEY_LEFT || keyCode == Keyboard.KEY_BACK) {
pageDec();
} else if (keyCode == Keyboard.KEY_HOME) {
pageFront();
}
}
示例6: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
if (keyCode == mc.gameSettings.keyBindInventory.getKeyCode() || keyCode == Keyboard.KEY_RETURN || keyCode == UHCCompass.instance.keyHandler.getKeyCode(KeyHandler.QUICKCOORDS))
{
try{
int x = Integer.parseInt(xCoord.getText());
int z = Integer.parseInt(zCoord.getText());
UHCCompass.TARGETX_PROPERTY.set(x);
UHCCompass.TARGETZ_PROPERTY.set(z);
}catch(Exception e){
mc.player.sendMessage(new TextComponentTranslation("uhccompass.invalidcoords"));
}
UHCCompass.syncConfig();
this.mc.displayGuiScreen(null);
if (this.mc.currentScreen == null)
{
this.mc.setIngameFocus();
}
} else if(keyCode == Keyboard.KEY_TAB || keyCode == Keyboard.KEY_SPACE){
xCoord.setFocused(!xCoord.isFocused());
zCoord.setFocused(!zCoord.isFocused());
}else if(Character.isDigit(typedChar) || typedChar == '-' || keyCode == Keyboard.KEY_BACK || keyCode == Keyboard.KEY_LEFT || keyCode == Keyboard.KEY_RIGHT){
xCoord.textboxKeyTyped(typedChar, keyCode);
zCoord.textboxKeyTyped(typedChar, keyCode);
}else if (keyCode == 201)
{
this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().getLineCount() - 1);
}
else if (keyCode == 209)
{
this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().getLineCount() + 1);
}
super.keyTyped(typedChar, keyCode);
}
示例7: 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);
}
}
}