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