Java Code Examples for org.lwjgl.input.Mouse#getButtonName()

The following examples show how to use org.lwjgl.input.Mouse#getButtonName() . 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: 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 2
Source File: AbstractKey.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Get the name of the key being set for CustomKey
 *
 * @param keyCode opengl name of the key being pressed
 * @return the name of the key
 */
protected String getKeyOrMouseName(int keyCode) {
    if (keyCode < 0) {
        String openGLName = Mouse.getButtonName(keyCode + 100);
        if (openGLName != null) {
            if (openGLName.equalsIgnoreCase("button0")) return "LMB";
            if (openGLName.equalsIgnoreCase("button1")) return "RMB";
        }

        return openGLName;
    }

    if (mod.getSettings().isUsingLiteralKeys()) {
        switch (keyCode) {
            case Keyboard.KEY_GRAVE:
                return "~";
            case Keyboard.KEY_MINUS:
            case Keyboard.KEY_SUBTRACT:
                return "-";
            case Keyboard.KEY_APOSTROPHE:
                return "'";
            case Keyboard.KEY_LBRACKET:
                return "[";
            case Keyboard.KEY_RBRACKET:
                return "]";
            case Keyboard.KEY_BACKSLASH:
                return "\\";
            case Keyboard.KEY_DIVIDE:
            case Keyboard.KEY_SLASH:
                return "/";
            case Keyboard.KEY_COMMA:
                return ",";
            case Keyboard.KEY_PERIOD:
                return ".";
            case Keyboard.KEY_SEMICOLON:
                return ";";
            case Keyboard.KEY_EQUALS:
                return "=";
            case Keyboard.KEY_UP:
                return "▲";
            case Keyboard.KEY_DOWN:
                return "▼";
            case Keyboard.KEY_LEFT:
                return "◀";
            case Keyboard.KEY_RIGHT:
                return "▶";
            case Keyboard.KEY_MULTIPLY:
                return "*";
            case Keyboard.KEY_ADD:
                return "+";
        }
    }

    return Keyboard.getKeyName(keyCode);
}
 
Example 3
Source File: KeybindButton.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
private String getName(int keyCode) {
    return keyCode < 0 ? Mouse.getButtonName(keyCode + 100) : Keyboard.getKeyName(keyCode);
}