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


Java Keyboard.getKeyName方法代碼示例

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


在下文中一共展示了Keyboard.getKeyName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: reloadOptions

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
public void reloadOptions() {
    try {
        for (final Window window : this.windows) {
            for (final Slot slot : window.slotList.slots) {
                for (final Slot optionSlot : slot.slotList.slots) {
                    if (optionSlot instanceof SlotOptionBoolean) {
                        ((SlotOptionBoolean)optionSlot).option.value = OptionManager.getOption(((SlotOptionBoolean)optionSlot).option.title, ((SlotOptionBoolean)optionSlot).option.parent).value;
                    }
                    else if (optionSlot instanceof SlotOptionDouble) {
                        ((SlotOptionDouble)optionSlot).option.value = ValueManager.getValue(((SlotOptionDouble)optionSlot).option.title, ((SlotOptionDouble)optionSlot).option.parent).value;
                    }
                    else {
                        if (!(optionSlot instanceof SlotOptionKeybind)) {
                            continue;
                        }
                        final int key = ((SlotOptionKeybind)optionSlot).option.parent.keyBind;
                        ((SlotOptionKeybind)optionSlot).option.value = Keyboard.getKeyName((key == 211 || key == 1) ? 0 : key);
                    }
                }
            }
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:27,代碼來源:Gui.java

示例2: getOptionDisplayString

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
public String getOptionDisplayString(int i)
{
	if(keyBindings[i].keyCode < 0)
	{
		return Mouse.getButtonName(keyBindings[i].keyCode + 100);
	}
    return Keyboard.getKeyName(keyBindings[i].keyCode);
}
 
開發者ID:jd-lang,項目名稱:betaexpansion,代碼行數:9,代碼來源:GameSettings.java

示例3: drawIcons

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
private void drawIcons(List<String> actions, int offset, int q) {
    PlayerWheelConfiguration config = PlayerProperties.getWheelConfig(MinecraftTools.getPlayer(mc));
    Map<String, Integer> hotkeys = config.getHotkeys();

    for (int i = 0; i < getActionSize(actions); i++) {
        String id = actions.get(i + page * 8);
        IWheelAction action = InteractionWheel.registry.get(id);
        if (action != null) {
            WheelActionElement element = action.createElement();
            mc.getTextureManager().bindTexture(new ResourceLocation(element.getTexture()));
            int txtw = element.getTxtw();
            int txth = element.getTxth();
            boolean selected = q == i;
            int u = selected ? element.getUhigh() : element.getUlow();
            int v = selected ? element.getVhigh() : element.getVlow();
            int offs = (i - offset + 8) % 8;
            int ox = guiLeft + iconOffsets.get(offs).getLeft();
            int oy = guiTop + iconOffsets.get(offs).getRight();
            RenderHelper.drawTexturedModalRect(ox, oy, u, v, 31, 31, txtw, txth);

            if (selected && hotkeys.containsKey(id)) {
                double angle = Math.PI * 2.0 * offs / 8 - Math.PI / 2.0 + Math.PI / 8.0;
                int tx = (int) (guiLeft + 80 + 86 * Math.cos(angle));
                int ty = (int) (guiTop + 80 + 86 * Math.sin(angle));
                String keyName = Keyboard.getKeyName(hotkeys.get(id));
                RenderHelper.renderText(mc, tx - mc.fontRenderer.getCharWidth(keyName.charAt(0)) / 2, ty - mc.fontRenderer.FONT_HEIGHT / 2, keyName);
            }
        }
    }
}
 
開發者ID:McJty,項目名稱:interactionwheel,代碼行數:31,代碼來源:GuiWheel.java

示例4: drawIcons

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
private void drawIcons() {
    PlayerWheelConfiguration config = PlayerProperties.getWheelConfig(MinecraftTools.getPlayer(mc));
    Map<String, Integer> hotkeys = config.getHotkeys();

    List<String> actions = InteractionWheel.interactionWheelImp.getSortedActions(MinecraftTools.getPlayer(mc));
    int ox = 0;
    int oy = 0;
    for (String id : actions) {
        IWheelAction action = InteractionWheel.registry.get(id);
        WheelActionElement element = action.createElement();
        mc.getTextureManager().bindTexture(new ResourceLocation(element.getTexture()));
        int txtw = element.getTxtw();
        int txth = element.getTxth();
        Boolean enabled = config.isEnabled(action.getId());
        if (enabled == null) {
            enabled = action.isDefaultEnabled();
        }
        int u = enabled ? element.getUhigh() : element.getUlow();
        int v = enabled ? element.getVhigh() : element.getVlow();
        RenderHelper.drawTexturedModalRect(guiLeft + ox * SIZE + MARGIN, guiTop + oy * SIZE + MARGIN, u, v, 31, 31, txtw, txth);

        if (hotkeys.containsKey(id)) {
            String keyName = Keyboard.getKeyName(hotkeys.get(id));
            RenderHelper.renderText(mc, guiLeft + ox * SIZE + MARGIN + 1, guiTop + oy * SIZE + MARGIN + 1, keyName);
        }

        ox++;
        if (ox >= 8) {
            ox = 0;
            oy++;
        }
    }
}
 
開發者ID:McJty,項目名稱:interactionwheel,代碼行數:34,代碼來源:GuiWheelConfig.java

示例5: onKeyPress

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
@Override
protected void onKeyPress(char typedChar, int keyCode)
{
	if(choosingKey)
	{
		selectedKey = Keyboard.getKeyName(keyCode);
		okButton.enabled = !selectedKey.equals("NONE");
	}else if(keyCode == 1)
		mc.displayGuiScreen(parent);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:11,代碼來源:NavigatorNewKeybindScreen.java

示例6: onKeyPress

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
public void onKeyPress()
{
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	int keyCode = Keyboard.getEventKey();
	if(keyCode == 0 || !Keyboard.getEventKeyState())
		return;
	String keyName = Keyboard.getKeyName(keyCode);
	
	KeyPressEvent event = new KeyPressEvent(keyCode, keyName);
	WurstClient.INSTANCE.events.fire(event);
	
	String commands = keybinds.getCommands(keyName);
	if(commands == null)
		return;
	
	commands = commands.replace(";", "�").replace("��", ";");
	for(String command : commands.split("�"))
	{
		command = command.trim();
		
		if(command.startsWith("."))
			cmdProcessor.runCommand(command.substring(1));
		else if(command.contains(" "))
			cmdProcessor.runCommand(command);
		else
		{
			Mod mod = mods.getModByName(command);
			
			if(mod != null)
				mod.toggle();
			else
				cmdProcessor.runCommand(command);
		}
	}
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:38,代碼來源:KeybindProcessor.java

示例7: onKeyTyped

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
public boolean onKeyTyped(final int key) {
    boolean binding = false;
    if (this.layerType == Type.BIND && this.name.contains(" [...]")) {
        binding = true;
        ClickGui.instance.currentModule.keyBind = ((key == 211 || key == 1) ? 0 : key);
        this.name = "Bind [" + Keyboard.getKeyName((ClickGui.instance.currentModule.keyBind == 211 || ClickGui.instance.currentModule.keyBind == 1) ? 0 : ClickGui.instance.currentModule.keyBind) + "]";
    }
    return binding;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:10,代碼來源:Button.java

示例8: keyPress

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
@Override
public void keyPress(int key, int keyChar) {
    super.keyPress(key, keyChar);
    if (this.setting) {
        Gui.instance.binding = false;
        this.setting = false;
        this.option.value = Keyboard.getKeyName((int)(key == 211 || key == 1 ? 0 : key));
        this.option.parent.keyBind = key == 211 || key == 1 ? 0 : key;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:11,代碼來源:SlotOptionKeybind.java

示例9: getKeyName

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
public static String getKeyName(int key) {
    if (key == Keyboard.KEY_NONE) 
        return "NONE";
    if ((key & MOUSE) != 0)
        return "MOUSE"+(key ^ MOUSE);
    String res = Keyboard.getKeyName(key);
    return res != null ? res : ""+key;
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:9,代碼來源:KeyHelper.java

示例10: getObjectToSave

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
@Override
protected BindingDataContainer getObjectToSave() {
    BindingDataContainer dataContainer = new BindingDataContainer();

    for (Keybinding binding : Serenity.getInstance().getKeybindManager().getBindings()) {
        String key = Keyboard.getKeyName(binding.getKey());

        dataContainer.keybindings.putIfAbsent(key, new ArrayList<>());
        Map<String, String> keybindAttributes = new HashMap<>();

        if (binding instanceof ModuleKeybinding) {
            ModuleKeybinding moduleKeybinding = (ModuleKeybinding) binding;
            keybindAttributes.put("identifier", "module");
            keybindAttributes.put("module", moduleKeybinding.getModule().getName().toLowerCase().replace(" ", ""));
            keybindAttributes.put("type", moduleKeybinding.getType().name());
        }
        if (binding instanceof CommandKeybinding) {
            CommandKeybinding commandKeybinding = (CommandKeybinding) binding;
            keybindAttributes.put("identifier", "command");
            keybindAttributes.put("command", commandKeybinding.getCommand());
        }

        dataContainer.keybindings.get(key).add(keybindAttributes);
    }

    return dataContainer;
}
 
開發者ID:SerenityEnterprises,項目名稱:SerenityCE,代碼行數:28,代碼來源:BindingDataHandler.java

示例11: toString

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
/**
 * @return the key name as a string
 * @since 3.0
 */
@Override
public String toString() {
	return Keyboard.getKeyName(getKey());
}
 
開發者ID:ImpactDevelopment,項目名稱:ClientAPI,代碼行數:9,代碼來源:Keybind.java

示例12: getKeyDisplayString

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
/**
 * Represents a key or mouse button as a string. Args: key
 */
public static String getKeyDisplayString(int p_74298_0_)
{
    return p_74298_0_ < 0 ? I18n.format("key.mouseButton", new Object[] {Integer.valueOf(p_74298_0_ + 101)}): (p_74298_0_ < 256 ? Keyboard.getKeyName(p_74298_0_) : String.format("%c", new Object[] {Character.valueOf((char)(p_74298_0_ - 256))}).toUpperCase());
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:GameSettings.java

示例13: getKeyName

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
public static String getKeyName(int key) {
	return Keyboard.getKeyName(key);
}
 
開發者ID:Moudoux,項目名稱:EMC,代碼行數:4,代碼來源:IKeyboard.java

示例14: getKeyDisplayString

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
/**
 * Gets the display name for a key.
 */
public static String getKeyDisplayString(int key)
{
    return key < 0 ? I18n.format("key.mouseButton", new Object[] {Integer.valueOf(key + 101)}): (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", new Object[] {Character.valueOf((char)(key - 256))}).toUpperCase());
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:8,代碼來源:GameSettings.java

示例15: getKeyName

import org.lwjgl.input.Keyboard; //導入方法依賴的package包/類
/**
 * Get the character representation of the key identified by the specified code
 * 
 * @param code The key code of the key to retrieve the name of
 * @return The name or character representation of the key requested
 */
public static String getKeyName(int code) {
	return Keyboard.getKeyName(code);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:10,代碼來源:Input.java


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