Java Code Examples for org.lwjgl.input.Keyboard#getKeyName()

The following examples show how to use org.lwjgl.input.Keyboard#getKeyName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FEResources.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the key mapped name.
 *
 * @param internalKeyName the internal key name
 * @return the key mapped name
 */
public static String getKeyMappedName(String internalKeyName){
	if(internalKeyName.toUpperCase().equals("ENTER")){
		internalKeyName = "RETURN";
	}
	int key = Keyboard.getKeyIndex(internalKeyName.toUpperCase());
	int mappedKey = getKeyMapped(key);
	String mappedName = Keyboard.getKeyName(mappedKey);
	//this might seem redundant, but it's to allow code using the string "Enter" to map to the key "Return"
	//which then maps the key according to the bindings (possibly to something else)
	//if it's still "return" we want this translated back to "enter"
	if(mappedName.equals("RETURN")){
		return "ENTER";
	}
	return mappedName;
}
 
Example 2
Source File: BindingHelper.java    From ForgeHax with MIT License 5 votes vote down vote up
public static String getIndexName(int code) {
  if (MOUSE_CODES.get(code) != null) {
    return MOUSE_CODES.get(code);
  } else if (code < 0) {
    return Mouse.getButtonName(100 + code);
  } else {
    return Keyboard.getKeyName(code);
  }
}
 
Example 3
Source File: TooltipOverlayHandler.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
@SubscribeEvent
public void tickEnd(TickEvent.RenderTickEvent event){
    if(event.phase == TickEvent.Phase.END && TickHandler.showTooltip() && ConfigHandler.shouldShowTooltip && FMLClientHandler.instance().getClient().inGameHasFocus && IGWMod.proxy.getPlayer().world != null) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        ScaledResolution sr = new ScaledResolution(mc);
        FontRenderer fontRenderer = FMLClientHandler.instance().getClient().fontRenderer;
        String objectName = TickHandler.getCurrentObjectName();
        String moreInfo = "'" + Keyboard.getKeyName(ClientProxy.openInterfaceKey.getKeyCode()) + "' for more info";
        fontRenderer.drawString(objectName, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(objectName) / 2, sr.getScaledHeight() / 2 - 20, 0xFFFFFFFF);
        fontRenderer.drawString(moreInfo, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(moreInfo) / 2, sr.getScaledHeight() / 2 - 10, 0xFFFFFFFF);
    }
}
 
Example 4
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 5
Source File: Options.java    From opsu with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String write() { return Keyboard.getKeyName(getGameKeyLeft()); }
 
Example 6
Source File: GuiConfig.java    From CraftingKeys with MIT License 4 votes vote down vote up
private void drawKeyValues() {
    for (int i = 0; i < keyValues.length; i++) {
        configButtons.get(i).displayString = Keyboard.getKeyName(keyValues[i]);
    }
}
 
Example 7
Source File: KeyOption.java    From opsu-dance with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String write ()
{
	return Keyboard.getKeyName(this.keycode);
}
 
Example 8
Source File: KeyOption.java    From opsu-dance with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getValueString ()
{
	return Keyboard.getKeyName(this.keycode);
}
 
Example 9
Source File: Options.java    From opsu with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getValueString() { return Keyboard.getKeyName(getGameKeyLeft()); }
 
Example 10
Source File: VanillaEnhancementsHud.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
private String getKeyString(int key) {
    return (key < 0) ? ("M" + (key + 101)) : ((key < 256) ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 11
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 12
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 13
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 14
Source File: Options.java    From opsu with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getValueString() { return Keyboard.getKeyName(getGameKeyRight()); }
 
Example 15
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 16
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 17
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 18
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 19
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 20
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? Keyboard.getKeyName(key) : String.format("%c", (char) (key - 256)).toUpperCase());
}