当前位置: 首页>>代码示例>>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;未经允许,请勿转载。