當前位置: 首頁>>代碼示例>>Java>>正文


Java Keyboard.KEY_RIGHT屬性代碼示例

本文整理匯總了Java中org.lwjgl.input.Keyboard.KEY_RIGHT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEY_RIGHT屬性的具體用法?Java Keyboard.KEY_RIGHT怎麽用?Java Keyboard.KEY_RIGHT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.lwjgl.input.Keyboard的用法示例。


在下文中一共展示了Keyboard.KEY_RIGHT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例4: 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();
	}
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:24,代碼來源:GuiBookGuide.java

示例5: keyTyped

@Override
public void keyTyped(char eventChar, int eventKey)
{
    if (owningScreen.enabled || eventKey == Keyboard.KEY_LEFT || eventKey == Keyboard.KEY_RIGHT
            || eventKey == Keyboard.KEY_HOME || eventKey == Keyboard.KEY_END)
    {
        this.textFieldValue.textboxKeyTyped((owningScreen.enabled ? eventChar : Keyboard.CHAR_NONE), eventKey);

        if (configElement.getValidationPattern() != null)
        {
            if (configElement.getValidationPattern().matcher(this.textFieldValue.getText().trim()).matches())
                isValidValue = true;
            else
                isValidValue = false;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:GuiEditArrayEntries.java

示例6: keyTyped

@Override
public void keyTyped(char c, int keyindex)
{
    if(!focused)
        return;
    
    if(keyindex == Keyboard.KEY_LEFT)
        cyclePrevItem();
    if(keyindex == Keyboard.KEY_RIGHT)
        cycleNextItem();
    if(keyindex == Keyboard.KEY_RETURN && actionCommand != null)
        sendAction(actionCommand);
}
 
開發者ID:TheCBProject,項目名稱:WirelessRedstone,代碼行數:13,代碼來源:GuiInvItemSlot.java

示例7: 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++;
        }
    }
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:37,代碼來源:GuiAskName.java

示例8: 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);
    }
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:37,代碼來源:GuiTextInput.java

示例9: keyPress

@Override
public void keyPress(int key, char keyChar) {
    if (focus) {
        if (key == Keyboard.KEY_RIGHT) {
            value.increment(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 0.1f : 1);
        } else if (key == Keyboard.KEY_LEFT) {
            value.decrement(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 0.1f : 1);
        }
    }
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:10,代碼來源:FloatComponent.java

示例10: onKeyPress

@Override
public void onKeyPress(KeyPressEvent event)
{
	if(tabGuiSpf.isHidden())
		return;
	
	if(tabOpened)
		switch(event.getKeyCode())
		{
			case Keyboard.KEY_LEFT:
			tabOpened = false;
			break;
			
			default:
			tabs.get(selected).onKeyPress(event.getKeyCode());
			break;
		}
	else
		switch(event.getKeyCode())
		{
			case Keyboard.KEY_DOWN:
			if(selected < tabs.size() - 1)
				selected++;
			else
				selected = 0;
			break;
			
			case Keyboard.KEY_UP:
			if(selected > 0)
				selected--;
			else
				selected = tabs.size() - 1;
			break;
			
			case Keyboard.KEY_RIGHT:
			tabOpened = true;
			break;
		}
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:39,代碼來源:TabGui.java

示例11: keyUp

@Override
public void keyUp(int keycode)
{
    super.keyUp(keycode);
    if (keycode == Keyboard.KEY_RIGHT || keycode == Keyboard.KEY_D)
        update(true, true);
    if (keycode == Keyboard.KEY_LEFT || keycode == Keyboard.KEY_A)
        update(false, true);
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:9,代碼來源:GuiIfTabletSP.java

示例12: keyTyped

@Override
public void keyTyped(char c, int key) {
    if (key == Keyboard.KEY_ESCAPE || key == Keyboard.KEY_RETURN) {
        setFocused(false);
    } else {
        String value = (String) getValue();
        if (key == Keyboard.KEY_BACK) {
            if (cursor == 0) return;
            --cursor;
            setValue(value.substring(0, cursor)
                    +value.substring(cursor+1,value.length()));
        } else if (key == Keyboard.KEY_DELETE) {
            if (cursor == value.length()) return;
            setValue(value.substring(0, cursor)
                    +value.substring(cursor+1,value.length()));
        } else if (key == Keyboard.KEY_HOME) {
            cursor = 0;
        } else if (key == Keyboard.KEY_END) {
            cursor = value.length();
        } else if (key == Keyboard.KEY_LEFT) {
            if (cursor > 0) --cursor;
        } else if (key == Keyboard.KEY_RIGHT) {
            if (cursor < value.length()) ++cursor;
        } else if (c != Keyboard.CHAR_NONE) {
            setValue(value.substring(0, cursor)+c
                    +value.substring(cursor,value.length()));
            ++cursor;
        }
        // TODO: selection, ^X, ^C, ^V
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:31,代碼來源:TextField.java

示例13: 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();
    }
}
 
開發者ID:McJty,項目名稱:Lector,代碼行數:11,代碼來源:GuiManual.java

示例14: update

public void update() {
	
	// Update holding tower
	if (holdingTower){
		tempTower.setX(getMouseTile().getX());
		tempTower.setY(getMouseTile().getY());
		tempTower.draw();
	}
	
	// Update all towers in the game
	for (Tower t : towerList){
		t.update();
		t.draw();
		t.updateEnemyList(waveManager.getCurrentWave().getEnemyList());
	}
	
	// Mouse Input
	if (Mouse.isButtonDown(0) && !leftMouseButtonDown)
		placeTower();
	if (Mouse.isButtonDown(1) && !rightMouseButtonDown)
		if (holdingTower)
			unpickTower();
		
	leftMouseButtonDown = Mouse.isButtonDown(0);
	rightMouseButtonDown = Mouse.isButtonDown(1);
	
	// Keyboard Input - Broken mechanics :/
	while (Keyboard.next()){
		if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT && Keyboard.getEventKeyState()){
			Clock.ChangeMulitplier(0.2f);
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_LEFT && Keyboard.getEventKeyState()){
			Clock.ChangeMulitplier(-0.2f);
		}
	}		
}
 
開發者ID:imaTowan,項目名稱:Towan,代碼行數:36,代碼來源:Player.java

示例15: 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);
}
 
開發者ID:The-Fireplace-Minecraft-Mods,項目名稱:UHC-Compass,代碼行數:37,代碼來源:GuiCoords.java


注:本文中的org.lwjgl.input.Keyboard.KEY_RIGHT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。