InputConstants.java
com.mojang.blaze3d.platform.InputConstants
信息
- 全限定名:com.mojang.blaze3d.platform.InputConstants
- 类型:public class
- 包:com.mojang.blaze3d.platform
- 源码路径:src/main/java/com/mojang/blaze3d/platform/InputConstants.java
- 起始行号:L33
- 职责:
TODO
字段/常量
-
KEY_0- 类型:
int - 修饰符:
public static final - 源码定位:
L34 - 说明:
TODO
- 类型:
-
KEY_1- 类型:
int - 修饰符:
public static final - 源码定位:
L35 - 说明:
TODO
- 类型:
-
KEY_2- 类型:
int - 修饰符:
public static final - 源码定位:
L36 - 说明:
TODO
- 类型:
-
KEY_3- 类型:
int - 修饰符:
public static final - 源码定位:
L37 - 说明:
TODO
- 类型:
-
KEY_4- 类型:
int - 修饰符:
public static final - 源码定位:
L38 - 说明:
TODO
- 类型:
-
KEY_5- 类型:
int - 修饰符:
public static final - 源码定位:
L39 - 说明:
TODO
- 类型:
-
KEY_6- 类型:
int - 修饰符:
public static final - 源码定位:
L40 - 说明:
TODO
- 类型:
-
KEY_7- 类型:
int - 修饰符:
public static final - 源码定位:
L41 - 说明:
TODO
- 类型:
-
KEY_8- 类型:
int - 修饰符:
public static final - 源码定位:
L42 - 说明:
TODO
- 类型:
-
KEY_9- 类型:
int - 修饰符:
public static final - 源码定位:
L43 - 说明:
TODO
- 类型:
-
KEY_A- 类型:
int - 修饰符:
public static final - 源码定位:
L44 - 说明:
TODO
- 类型:
-
KEY_B- 类型:
int - 修饰符:
public static final - 源码定位:
L45 - 说明:
TODO
- 类型:
-
KEY_C- 类型:
int - 修饰符:
public static final - 源码定位:
L46 - 说明:
TODO
- 类型:
-
KEY_D- 类型:
int - 修饰符:
public static final - 源码定位:
L47 - 说明:
TODO
- 类型:
-
KEY_E- 类型:
int - 修饰符:
public static final - 源码定位:
L48 - 说明:
TODO
- 类型:
-
KEY_F- 类型:
int - 修饰符:
public static final - 源码定位:
L49 - 说明:
TODO
- 类型:
-
KEY_G- 类型:
int - 修饰符:
public static final - 源码定位:
L50 - 说明:
TODO
- 类型:
-
KEY_H- 类型:
int - 修饰符:
public static final - 源码定位:
L51 - 说明:
TODO
- 类型:
-
KEY_I- 类型:
int - 修饰符:
public static final - 源码定位:
L52 - 说明:
TODO
- 类型:
-
KEY_J- 类型:
int - 修饰符:
public static final - 源码定位:
L53 - 说明:
TODO
- 类型:
-
KEY_K- 类型:
int - 修饰符:
public static final - 源码定位:
L54 - 说明:
TODO
- 类型:
-
KEY_L- 类型:
int - 修饰符:
public static final - 源码定位:
L55 - 说明:
TODO
- 类型:
-
KEY_M- 类型:
int - 修饰符:
public static final - 源码定位:
L56 - 说明:
TODO
- 类型:
-
KEY_N- 类型:
int - 修饰符:
public static final - 源码定位:
L57 - 说明:
TODO
- 类型:
-
KEY_O- 类型:
int - 修饰符:
public static final - 源码定位:
L58 - 说明:
TODO
- 类型:
-
KEY_P- 类型:
int - 修饰符:
public static final - 源码定位:
L59 - 说明:
TODO
- 类型:
-
KEY_Q- 类型:
int - 修饰符:
public static final - 源码定位:
L60 - 说明:
TODO
- 类型:
-
KEY_R- 类型:
int - 修饰符:
public static final - 源码定位:
L61 - 说明:
TODO
- 类型:
-
KEY_S- 类型:
int - 修饰符:
public static final - 源码定位:
L62 - 说明:
TODO
- 类型:
-
KEY_T- 类型:
int - 修饰符:
public static final - 源码定位:
L63 - 说明:
TODO
- 类型:
-
KEY_U- 类型:
int - 修饰符:
public static final - 源码定位:
L64 - 说明:
TODO
- 类型:
-
KEY_V- 类型:
int - 修饰符:
public static final - 源码定位:
L65 - 说明:
TODO
- 类型:
-
KEY_W- 类型:
int - 修饰符:
public static final - 源码定位:
L66 - 说明:
TODO
- 类型:
-
KEY_X- 类型:
int - 修饰符:
public static final - 源码定位:
L67 - 说明:
TODO
- 类型:
-
KEY_Y- 类型:
int - 修饰符:
public static final - 源码定位:
L68 - 说明:
TODO
- 类型:
-
KEY_Z- 类型:
int - 修饰符:
public static final - 源码定位:
L69 - 说明:
TODO
- 类型:
-
KEY_F1- 类型:
int - 修饰符:
public static final - 源码定位:
L70 - 说明:
TODO
- 类型:
-
KEY_F2- 类型:
int - 修饰符:
public static final - 源码定位:
L71 - 说明:
TODO
- 类型:
-
KEY_F3- 类型:
int - 修饰符:
public static final - 源码定位:
L72 - 说明:
TODO
- 类型:
-
KEY_F4- 类型:
int - 修饰符:
public static final - 源码定位:
L73 - 说明:
TODO
- 类型:
-
KEY_F5- 类型:
int - 修饰符:
public static final - 源码定位:
L74 - 说明:
TODO
- 类型:
-
KEY_F6- 类型:
int - 修饰符:
public static final - 源码定位:
L75 - 说明:
TODO
- 类型:
-
KEY_F7- 类型:
int - 修饰符:
public static final - 源码定位:
L76 - 说明:
TODO
- 类型:
-
KEY_F8- 类型:
int - 修饰符:
public static final - 源码定位:
L77 - 说明:
TODO
- 类型:
-
KEY_F9- 类型:
int - 修饰符:
public static final - 源码定位:
L78 - 说明:
TODO
- 类型:
-
KEY_F10- 类型:
int - 修饰符:
public static final - 源码定位:
L79 - 说明:
TODO
- 类型:
-
KEY_F11- 类型:
int - 修饰符:
public static final - 源码定位:
L80 - 说明:
TODO
- 类型:
-
KEY_F12- 类型:
int - 修饰符:
public static final - 源码定位:
L81 - 说明:
TODO
- 类型:
-
KEY_F13- 类型:
int - 修饰符:
public static final - 源码定位:
L82 - 说明:
TODO
- 类型:
-
KEY_F14- 类型:
int - 修饰符:
public static final - 源码定位:
L83 - 说明:
TODO
- 类型:
-
KEY_F15- 类型:
int - 修饰符:
public static final - 源码定位:
L84 - 说明:
TODO
- 类型:
-
KEY_F16- 类型:
int - 修饰符:
public static final - 源码定位:
L85 - 说明:
TODO
- 类型:
-
KEY_F17- 类型:
int - 修饰符:
public static final - 源码定位:
L86 - 说明:
TODO
- 类型:
-
KEY_F18- 类型:
int - 修饰符:
public static final - 源码定位:
L87 - 说明:
TODO
- 类型:
-
KEY_F19- 类型:
int - 修饰符:
public static final - 源码定位:
L88 - 说明:
TODO
- 类型:
-
KEY_F20- 类型:
int - 修饰符:
public static final - 源码定位:
L89 - 说明:
TODO
- 类型:
-
KEY_F21- 类型:
int - 修饰符:
public static final - 源码定位:
L90 - 说明:
TODO
- 类型:
-
KEY_F22- 类型:
int - 修饰符:
public static final - 源码定位:
L91 - 说明:
TODO
- 类型:
-
KEY_F23- 类型:
int - 修饰符:
public static final - 源码定位:
L92 - 说明:
TODO
- 类型:
-
KEY_F24- 类型:
int - 修饰符:
public static final - 源码定位:
L93 - 说明:
TODO
- 类型:
-
KEY_F25- 类型:
int - 修饰符:
public static final - 源码定位:
L94 - 说明:
TODO
- 类型:
-
KEY_NUMLOCK- 类型:
int - 修饰符:
public static final - 源码定位:
L95 - 说明:
TODO
- 类型:
-
KEY_NUMPAD0- 类型:
int - 修饰符:
public static final - 源码定位:
L96 - 说明:
TODO
- 类型:
-
KEY_NUMPAD1- 类型:
int - 修饰符:
public static final - 源码定位:
L97 - 说明:
TODO
- 类型:
-
KEY_NUMPAD2- 类型:
int - 修饰符:
public static final - 源码定位:
L98 - 说明:
TODO
- 类型:
-
KEY_NUMPAD3- 类型:
int - 修饰符:
public static final - 源码定位:
L99 - 说明:
TODO
- 类型:
-
KEY_NUMPAD4- 类型:
int - 修饰符:
public static final - 源码定位:
L100 - 说明:
TODO
- 类型:
-
KEY_NUMPAD5- 类型:
int - 修饰符:
public static final - 源码定位:
L101 - 说明:
TODO
- 类型:
-
KEY_NUMPAD6- 类型:
int - 修饰符:
public static final - 源码定位:
L102 - 说明:
TODO
- 类型:
-
KEY_NUMPAD7- 类型:
int - 修饰符:
public static final - 源码定位:
L103 - 说明:
TODO
- 类型:
-
KEY_NUMPAD8- 类型:
int - 修饰符:
public static final - 源码定位:
L104 - 说明:
TODO
- 类型:
-
KEY_NUMPAD9- 类型:
int - 修饰符:
public static final - 源码定位:
L105 - 说明:
TODO
- 类型:
-
KEY_NUMPADCOMMA- 类型:
int - 修饰符:
public static final - 源码定位:
L106 - 说明:
TODO
- 类型:
-
KEY_NUMPADENTER- 类型:
int - 修饰符:
public static final - 源码定位:
L107 - 说明:
TODO
- 类型:
-
KEY_NUMPADEQUALS- 类型:
int - 修饰符:
public static final - 源码定位:
L108 - 说明:
TODO
- 类型:
-
KEY_DOWN- 类型:
int - 修饰符:
public static final - 源码定位:
L109 - 说明:
TODO
- 类型:
-
KEY_LEFT- 类型:
int - 修饰符:
public static final - 源码定位:
L110 - 说明:
TODO
- 类型:
-
KEY_RIGHT- 类型:
int - 修饰符:
public static final - 源码定位:
L111 - 说明:
TODO
- 类型:
-
KEY_UP- 类型:
int - 修饰符:
public static final - 源码定位:
L112 - 说明:
TODO
- 类型:
-
KEY_ADD- 类型:
int - 修饰符:
public static final - 源码定位:
L113 - 说明:
TODO
- 类型:
-
KEY_APOSTROPHE- 类型:
int - 修饰符:
public static final - 源码定位:
L114 - 说明:
TODO
- 类型:
-
KEY_BACKSLASH- 类型:
int - 修饰符:
public static final - 源码定位:
L115 - 说明:
TODO
- 类型:
-
KEY_COMMA- 类型:
int - 修饰符:
public static final - 源码定位:
L116 - 说明:
TODO
- 类型:
-
KEY_EQUALS- 类型:
int - 修饰符:
public static final - 源码定位:
L117 - 说明:
TODO
- 类型:
-
KEY_GRAVE- 类型:
int - 修饰符:
public static final - 源码定位:
L118 - 说明:
TODO
- 类型:
-
KEY_LBRACKET- 类型:
int - 修饰符:
public static final - 源码定位:
L119 - 说明:
TODO
- 类型:
-
KEY_MINUS- 类型:
int - 修饰符:
public static final - 源码定位:
L120 - 说明:
TODO
- 类型:
-
KEY_MULTIPLY- 类型:
int - 修饰符:
public static final - 源码定位:
L121 - 说明:
TODO
- 类型:
-
KEY_PERIOD- 类型:
int - 修饰符:
public static final - 源码定位:
L122 - 说明:
TODO
- 类型:
-
KEY_RBRACKET- 类型:
int - 修饰符:
public static final - 源码定位:
L123 - 说明:
TODO
- 类型:
-
KEY_SEMICOLON- 类型:
int - 修饰符:
public static final - 源码定位:
L124 - 说明:
TODO
- 类型:
-
KEY_SLASH- 类型:
int - 修饰符:
public static final - 源码定位:
L125 - 说明:
TODO
- 类型:
-
KEY_SPACE- 类型:
int - 修饰符:
public static final - 源码定位:
L126 - 说明:
TODO
- 类型:
-
KEY_TAB- 类型:
int - 修饰符:
public static final - 源码定位:
L127 - 说明:
TODO
- 类型:
-
KEY_LALT- 类型:
int - 修饰符:
public static final - 源码定位:
L128 - 说明:
TODO
- 类型:
-
KEY_LCONTROL- 类型:
int - 修饰符:
public static final - 源码定位:
L129 - 说明:
TODO
- 类型:
-
KEY_LSHIFT- 类型:
int - 修饰符:
public static final - 源码定位:
L130 - 说明:
TODO
- 类型:
-
KEY_LSUPER- 类型:
int - 修饰符:
public static final - 源码定位:
L131 - 说明:
TODO
- 类型:
-
KEY_RALT- 类型:
int - 修饰符:
public static final - 源码定位:
L132 - 说明:
TODO
- 类型:
-
KEY_RCONTROL- 类型:
int - 修饰符:
public static final - 源码定位:
L133 - 说明:
TODO
- 类型:
-
KEY_RSHIFT- 类型:
int - 修饰符:
public static final - 源码定位:
L134 - 说明:
TODO
- 类型:
-
KEY_RSUPER- 类型:
int - 修饰符:
public static final - 源码定位:
L135 - 说明:
TODO
- 类型:
-
KEY_RETURN- 类型:
int - 修饰符:
public static final - 源码定位:
L136 - 说明:
TODO
- 类型:
-
KEY_ESCAPE- 类型:
int - 修饰符:
public static final - 源码定位:
L137 - 说明:
TODO
- 类型:
-
KEY_BACKSPACE- 类型:
int - 修饰符:
public static final - 源码定位:
L138 - 说明:
TODO
- 类型:
-
KEY_DELETE- 类型:
int - 修饰符:
public static final - 源码定位:
L139 - 说明:
TODO
- 类型:
-
KEY_END- 类型:
int - 修饰符:
public static final - 源码定位:
L140 - 说明:
TODO
- 类型:
-
KEY_HOME- 类型:
int - 修饰符:
public static final - 源码定位:
L141 - 说明:
TODO
- 类型:
-
KEY_INSERT- 类型:
int - 修饰符:
public static final - 源码定位:
L142 - 说明:
TODO
- 类型:
-
KEY_PAGEDOWN- 类型:
int - 修饰符:
public static final - 源码定位:
L143 - 说明:
TODO
- 类型:
-
KEY_PAGEUP- 类型:
int - 修饰符:
public static final - 源码定位:
L144 - 说明:
TODO
- 类型:
-
KEY_CAPSLOCK- 类型:
int - 修饰符:
public static final - 源码定位:
L145 - 说明:
TODO
- 类型:
-
KEY_PAUSE- 类型:
int - 修饰符:
public static final - 源码定位:
L146 - 说明:
TODO
- 类型:
-
KEY_SCROLLLOCK- 类型:
int - 修饰符:
public static final - 源码定位:
L147 - 说明:
TODO
- 类型:
-
KEY_PRINTSCREEN- 类型:
int - 修饰符:
public static final - 源码定位:
L148 - 说明:
TODO
- 类型:
-
PRESS- 类型:
int - 修饰符:
public static final - 源码定位:
L149 - 说明:
TODO
- 类型:
-
RELEASE- 类型:
int - 修饰符:
public static final - 源码定位:
L150 - 说明:
TODO
- 类型:
-
REPEAT- 类型:
int - 修饰符:
public static final - 源码定位:
L151 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_LEFT- 类型:
int - 修饰符:
public static final - 源码定位:
L152 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_RIGHT- 类型:
int - 修饰符:
public static final - 源码定位:
L153 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_MIDDLE- 类型:
int - 修饰符:
public static final - 源码定位:
L154 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_4- 类型:
int - 修饰符:
public static final - 源码定位:
L155 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_5- 类型:
int - 修饰符:
public static final - 源码定位:
L156 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_6- 类型:
int - 修饰符:
public static final - 源码定位:
L157 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_7- 类型:
int - 修饰符:
public static final - 源码定位:
L158 - 说明:
TODO
- 类型:
-
MOUSE_BUTTON_8- 类型:
int - 修饰符:
public static final - 源码定位:
L159 - 说明:
TODO
- 类型:
-
MOD_SHIFT- 类型:
int - 修饰符:
public static final - 源码定位:
L160 - 说明:
TODO
- 类型:
-
MOD_CONTROL- 类型:
int - 修饰符:
public static final - 源码定位:
L161 - 说明:
TODO
- 类型:
-
MOD_ALT- 类型:
int - 修饰符:
public static final - 源码定位:
L162 - 说明:
TODO
- 类型:
-
MOD_SUPER- 类型:
int - 修饰符:
public static final - 源码定位:
L163 - 说明:
TODO
- 类型:
-
MOD_CAPS_LOCK- 类型:
int - 修饰符:
public static final - 源码定位:
L164 - 说明:
TODO
- 类型:
-
MOD_NUM_LOCK- 类型:
int - 修饰符:
public static final - 源码定位:
L165 - 说明:
TODO
- 类型:
-
CURSOR- 类型:
int - 修饰符:
public static final - 源码定位:
L166 - 说明:
TODO
- 类型:
-
CURSOR_DISABLED- 类型:
int - 修饰符:
public static final - 源码定位:
L167 - 说明:
TODO
- 类型:
-
CURSOR_NORMAL- 类型:
int - 修饰符:
public static final - 源码定位:
L168 - 说明:
TODO
- 类型:
-
UNKNOWN- 类型:
InputConstants.Key - 修饰符:
public static final - 源码定位:
L169 - 说明:
TODO
- 类型:
内部类/嵌套类型
-
com.mojang.blaze3d.platform.InputConstants.Key- 类型:
class - 修饰符:
public static final - 源码定位:
L241 - 说明:
TODO
- 类型:
-
com.mojang.blaze3d.platform.InputConstants.Type- 类型:
enum - 修饰符:
public static - 源码定位:
L304 - 说明:
TODO
- 类型:
-
com.mojang.blaze3d.platform.InputConstants.Value- 类型:
annotation - 修饰符:
public - 源码定位:
L482 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static InputConstants.Key getKey(KeyEvent event) @ L171
- 方法名:getKey
- 源码定位:L171
- 返回类型:InputConstants.Key
- 修饰符:public static
参数:
- event: KeyEvent
说明:
TODO
public static InputConstants.Key getKey(String name) @ L175
- 方法名:getKey
- 源码定位:L175
- 返回类型:InputConstants.Key
- 修饰符:public static
参数:
- name: String
说明:
TODO
public static boolean isKeyDown(Window window, int key) @ L195
- 方法名:isKeyDown
- 源码定位:L195
- 返回类型:boolean
- 修饰符:public static
参数:
- window: Window
- key: int
说明:
TODO
public static void setupKeyboardCallbacks(Window window, GLFWKeyCallbackI keyPressCallback, GLFWCharCallbackI charTypedCallback, GLFWPreeditCallbackI preeditCallback, GLFWIMEStatusCallbackI imeStatusCallback) @ L199
- 方法名:setupKeyboardCallbacks
- 源码定位:L199
- 返回类型:void
- 修饰符:public static
参数:
- window: Window
- keyPressCallback: GLFWKeyCallbackI
- charTypedCallback: GLFWCharCallbackI
- preeditCallback: GLFWPreeditCallbackI
- imeStatusCallback: GLFWIMEStatusCallbackI
说明:
TODO
public static void setupMouseCallbacks(Window window, GLFWCursorPosCallbackI onMoveCallback, GLFWMouseButtonCallbackI onPressCallback, GLFWScrollCallbackI onScrollCallback, GLFWDropCallbackI onDropCallback) @ L212
- 方法名:setupMouseCallbacks
- 源码定位:L212
- 返回类型:void
- 修饰符:public static
参数:
- window: Window
- onMoveCallback: GLFWCursorPosCallbackI
- onPressCallback: GLFWMouseButtonCallbackI
- onScrollCallback: GLFWScrollCallbackI
- onDropCallback: GLFWDropCallbackI
说明:
TODO
public static void grabOrReleaseMouse(Window window, int cursorMode, double xpos, double ypos) @ L225
- 方法名:grabOrReleaseMouse
- 源码定位:L225
- 返回类型:void
- 修饰符:public static
参数:
- window: Window
- cursorMode: int
- xpos: double
- ypos: double
说明:
TODO
public static boolean isRawMouseInputSupported() @ L230
- 方法名:isRawMouseInputSupported
- 源码定位:L230
- 返回类型:boolean
- 修饰符:public static
参数:
- 无
说明:
TODO
public static void updateRawMouseInput(Window window, boolean value) @ L234
- 方法名:updateRawMouseInput
- 源码定位:L234
- 返回类型:void
- 修饰符:public static
参数:
- window: Window
- value: boolean
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class InputConstants {
public static final int KEY_0 = 48;
public static final int KEY_1 = 49;
public static final int KEY_2 = 50;
public static final int KEY_3 = 51;
public static final int KEY_4 = 52;
public static final int KEY_5 = 53;
public static final int KEY_6 = 54;
public static final int KEY_7 = 55;
public static final int KEY_8 = 56;
public static final int KEY_9 = 57;
public static final int KEY_A = 65;
public static final int KEY_B = 66;
public static final int KEY_C = 67;
public static final int KEY_D = 68;
public static final int KEY_E = 69;
public static final int KEY_F = 70;
public static final int KEY_G = 71;
public static final int KEY_H = 72;
public static final int KEY_I = 73;
public static final int KEY_J = 74;
public static final int KEY_K = 75;
public static final int KEY_L = 76;
public static final int KEY_M = 77;
public static final int KEY_N = 78;
public static final int KEY_O = 79;
public static final int KEY_P = 80;
public static final int KEY_Q = 81;
public static final int KEY_R = 82;
public static final int KEY_S = 83;
public static final int KEY_T = 84;
public static final int KEY_U = 85;
public static final int KEY_V = 86;
public static final int KEY_W = 87;
public static final int KEY_X = 88;
public static final int KEY_Y = 89;
public static final int KEY_Z = 90;
public static final int KEY_F1 = 290;
public static final int KEY_F2 = 291;
public static final int KEY_F3 = 292;
public static final int KEY_F4 = 293;
public static final int KEY_F5 = 294;
public static final int KEY_F6 = 295;
public static final int KEY_F7 = 296;
public static final int KEY_F8 = 297;
public static final int KEY_F9 = 298;
public static final int KEY_F10 = 299;
public static final int KEY_F11 = 300;
public static final int KEY_F12 = 301;
public static final int KEY_F13 = 302;
public static final int KEY_F14 = 303;
public static final int KEY_F15 = 304;
public static final int KEY_F16 = 305;
public static final int KEY_F17 = 306;
public static final int KEY_F18 = 307;
public static final int KEY_F19 = 308;
public static final int KEY_F20 = 309;
public static final int KEY_F21 = 310;
public static final int KEY_F22 = 311;
public static final int KEY_F23 = 312;
public static final int KEY_F24 = 313;
public static final int KEY_F25 = 314;
public static final int KEY_NUMLOCK = 282;
public static final int KEY_NUMPAD0 = 320;
public static final int KEY_NUMPAD1 = 321;
public static final int KEY_NUMPAD2 = 322;
public static final int KEY_NUMPAD3 = 323;
public static final int KEY_NUMPAD4 = 324;
public static final int KEY_NUMPAD5 = 325;
public static final int KEY_NUMPAD6 = 326;
public static final int KEY_NUMPAD7 = 327;
public static final int KEY_NUMPAD8 = 328;
public static final int KEY_NUMPAD9 = 329;
public static final int KEY_NUMPADCOMMA = 330;
public static final int KEY_NUMPADENTER = 335;
public static final int KEY_NUMPADEQUALS = 336;
public static final int KEY_DOWN = 264;
public static final int KEY_LEFT = 263;
public static final int KEY_RIGHT = 262;
public static final int KEY_UP = 265;
public static final int KEY_ADD = 334;
public static final int KEY_APOSTROPHE = 39;
public static final int KEY_BACKSLASH = 92;
public static final int KEY_COMMA = 44;
public static final int KEY_EQUALS = 61;
public static final int KEY_GRAVE = 96;
public static final int KEY_LBRACKET = 91;
public static final int KEY_MINUS = 45;
public static final int KEY_MULTIPLY = 332;
public static final int KEY_PERIOD = 46;
public static final int KEY_RBRACKET = 93;
public static final int KEY_SEMICOLON = 59;
public static final int KEY_SLASH = 47;
public static final int KEY_SPACE = 32;
public static final int KEY_TAB = 258;
public static final int KEY_LALT = 342;
public static final int KEY_LCONTROL = 341;
public static final int KEY_LSHIFT = 340;
public static final int KEY_LSUPER = 343;
public static final int KEY_RALT = 346;
public static final int KEY_RCONTROL = 345;
public static final int KEY_RSHIFT = 344;
public static final int KEY_RSUPER = 347;
public static final int KEY_RETURN = 257;
public static final int KEY_ESCAPE = 256;
public static final int KEY_BACKSPACE = 259;
public static final int KEY_DELETE = 261;
public static final int KEY_END = 269;
public static final int KEY_HOME = 268;
public static final int KEY_INSERT = 260;
public static final int KEY_PAGEDOWN = 267;
public static final int KEY_PAGEUP = 266;
public static final int KEY_CAPSLOCK = 280;
public static final int KEY_PAUSE = 284;
public static final int KEY_SCROLLLOCK = 281;
public static final int KEY_PRINTSCREEN = 283;
public static final int PRESS = 1;
public static final int RELEASE = 0;
public static final int REPEAT = 2;
public static final int MOUSE_BUTTON_LEFT = 0;
public static final int MOUSE_BUTTON_RIGHT = 1;
public static final int MOUSE_BUTTON_MIDDLE = 2;
public static final int MOUSE_BUTTON_4 = 3;
public static final int MOUSE_BUTTON_5 = 4;
public static final int MOUSE_BUTTON_6 = 5;
public static final int MOUSE_BUTTON_7 = 6;
public static final int MOUSE_BUTTON_8 = 0;
public static final int MOD_SHIFT = 1;
public static final int MOD_CONTROL = 2;
public static final int MOD_ALT = 4;
public static final int MOD_SUPER = 8;
public static final int MOD_CAPS_LOCK = 16;
public static final int MOD_NUM_LOCK = 32;
public static final int CURSOR = 208897;
public static final int CURSOR_DISABLED = 212995;
public static final int CURSOR_NORMAL = 212993;
public static final InputConstants.Key UNKNOWN = InputConstants.Type.KEYSYM.getOrCreate(-1);
public static InputConstants.Key getKey(KeyEvent event) {
return event.key() == -1 ? InputConstants.Type.SCANCODE.getOrCreate(event.scancode()) : InputConstants.Type.KEYSYM.getOrCreate(event.key());
}
public static InputConstants.Key getKey(String name) {
if (InputConstants.Key.NAME_MAP.containsKey(name)) {
return InputConstants.Key.NAME_MAP.get(name);
} else {
for (InputConstants.Type type : InputConstants.Type.values()) {
if (name.startsWith(type.defaultPrefix)) {
String humanReadableValue = name.substring(type.defaultPrefix.length() + 1);
int intValue = Integer.parseInt(humanReadableValue);
if (type == InputConstants.Type.MOUSE) {
intValue--;
}
return type.getOrCreate(intValue);
}
}
throw new IllegalArgumentException("Unknown key name: " + name);
}
}
public static boolean isKeyDown(Window window, int key) {
return GLFW.glfwGetKey(window.handle(), key) == 1;
}
public static void setupKeyboardCallbacks(
Window window,
GLFWKeyCallbackI keyPressCallback,
GLFWCharCallbackI charTypedCallback,
GLFWPreeditCallbackI preeditCallback,
GLFWIMEStatusCallbackI imeStatusCallback
) {
GLFW.glfwSetKeyCallback(window.handle(), keyPressCallback);
GLFW.glfwSetCharCallback(window.handle(), charTypedCallback);
GLFW.glfwSetPreeditCallback(window.handle(), preeditCallback);
GLFW.glfwSetIMEStatusCallback(window.handle(), imeStatusCallback);
}
public static void setupMouseCallbacks(
Window window,
GLFWCursorPosCallbackI onMoveCallback,
GLFWMouseButtonCallbackI onPressCallback,
GLFWScrollCallbackI onScrollCallback,
GLFWDropCallbackI onDropCallback
) {
GLFW.glfwSetCursorPosCallback(window.handle(), onMoveCallback);
GLFW.glfwSetMouseButtonCallback(window.handle(), onPressCallback);
GLFW.glfwSetScrollCallback(window.handle(), onScrollCallback);
GLFW.glfwSetDropCallback(window.handle(), onDropCallback);
}
public static void grabOrReleaseMouse(Window window, int cursorMode, double xpos, double ypos) {
GLFW.glfwSetCursorPos(window.handle(), xpos, ypos);
GLFW.glfwSetInputMode(window.handle(), 208897, cursorMode);
}
public static boolean isRawMouseInputSupported() {
return GLFW.glfwRawMouseMotionSupported();
}
public static void updateRawMouseInput(Window window, boolean value) {
if (isRawMouseInputSupported()) {
GLFW.glfwSetInputMode(window.handle(), 208901, GLX.glfwBool(value));
}
}
@OnlyIn(Dist.CLIENT)
public static final class Key {
private final String name;
private final InputConstants.Type type;
private final int value;
private final Supplier<Component> displayName;
private static final Map<String, InputConstants.Key> NAME_MAP = Maps.newHashMap();
private Key(String name, InputConstants.Type type, int value) {
this.name = name;
this.type = type;
this.value = value;
this.displayName = Suppliers.memoize(() -> type.displayTextSupplier.apply(value, name));
NAME_MAP.put(name, this);
}
public InputConstants.Type getType() {
return this.type;
}
public int getValue() {
return this.value;
}
public String getName() {
return this.name;
}
public Component getDisplayName() {
return this.displayName.get();
}
public OptionalInt getNumericKeyValue() {
if (this.value >= 48 && this.value <= 57) {
return OptionalInt.of(this.value - 48);
} else {
return this.value >= 320 && this.value <= 329 ? OptionalInt.of(this.value - 320) : OptionalInt.empty();
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
} else if (o != null && this.getClass() == o.getClass()) {
InputConstants.Key key = (InputConstants.Key)o;
return this.value == key.value && this.type == key.type;
} else {
return false;
}
}
@Override
public int hashCode() {
return Objects.hash(this.type, this.value);
}
@Override
public String toString() {
return this.name;
}
}
@OnlyIn(Dist.CLIENT)
public static enum Type {
KEYSYM("key.keyboard", (value, name) -> {
if ("key.keyboard.unknown".equals(name)) {
return Component.translatable(name);
} else {
String systemName = GLFW.glfwGetKeyName(value, -1);
return systemName != null ? Component.literal(systemName.toUpperCase(Locale.ROOT)) : Component.translatable(name);
}
}),
SCANCODE("scancode", (value, name) -> {
String systemName = GLFW.glfwGetKeyName(-1, value);
return systemName != null ? Component.literal(systemName) : Component.translatable(name);
}),
MOUSE("key.mouse", (value, name) -> Language.getInstance().has(name) ? Component.translatable(name) : Component.translatable("key.mouse", value + 1));
private static final String KEY_KEYBOARD_UNKNOWN = "key.keyboard.unknown";
private final Int2ObjectMap<InputConstants.Key> map = new Int2ObjectOpenHashMap<>();
private final String defaultPrefix;
private final BiFunction<Integer, String, Component> displayTextSupplier;
private static void addKey(InputConstants.Type type, String name, int value) {
InputConstants.Key key = new InputConstants.Key(name, type, value);
type.map.put(value, key);
}
private Type(String defaultPrefix, BiFunction<Integer, String, Component> displayTextSupplier) {
this.defaultPrefix = defaultPrefix;
this.displayTextSupplier = displayTextSupplier;
}
public InputConstants.Key getOrCreate(int value) {
return this.map.computeIfAbsent(value, intValue -> {
int humanReadableValue = intValue;
if (this == MOUSE) {
humanReadableValue = intValue + 1;
}
String name = this.defaultPrefix + "." + humanReadableValue;
return new InputConstants.Key(name, this, intValue);
});
}
static {
addKey(KEYSYM, "key.keyboard.unknown", -1);
addKey(MOUSE, "key.mouse.left", 0);
addKey(MOUSE, "key.mouse.right", 1);
addKey(MOUSE, "key.mouse.middle", 2);
addKey(MOUSE, "key.mouse.4", 3);
addKey(MOUSE, "key.mouse.5", 4);
addKey(MOUSE, "key.mouse.6", 5);
addKey(MOUSE, "key.mouse.7", 6);
addKey(MOUSE, "key.mouse.8", 7);
addKey(KEYSYM, "key.keyboard.0", 48);
addKey(KEYSYM, "key.keyboard.1", 49);
addKey(KEYSYM, "key.keyboard.2", 50);
addKey(KEYSYM, "key.keyboard.3", 51);
addKey(KEYSYM, "key.keyboard.4", 52);
addKey(KEYSYM, "key.keyboard.5", 53);
addKey(KEYSYM, "key.keyboard.6", 54);
addKey(KEYSYM, "key.keyboard.7", 55);
addKey(KEYSYM, "key.keyboard.8", 56);
addKey(KEYSYM, "key.keyboard.9", 57);
addKey(KEYSYM, "key.keyboard.a", 65);
addKey(KEYSYM, "key.keyboard.b", 66);
addKey(KEYSYM, "key.keyboard.c", 67);
addKey(KEYSYM, "key.keyboard.d", 68);
addKey(KEYSYM, "key.keyboard.e", 69);
addKey(KEYSYM, "key.keyboard.f", 70);
addKey(KEYSYM, "key.keyboard.g", 71);
addKey(KEYSYM, "key.keyboard.h", 72);
addKey(KEYSYM, "key.keyboard.i", 73);
addKey(KEYSYM, "key.keyboard.j", 74);
addKey(KEYSYM, "key.keyboard.k", 75);
addKey(KEYSYM, "key.keyboard.l", 76);
addKey(KEYSYM, "key.keyboard.m", 77);
addKey(KEYSYM, "key.keyboard.n", 78);
addKey(KEYSYM, "key.keyboard.o", 79);
addKey(KEYSYM, "key.keyboard.p", 80);
addKey(KEYSYM, "key.keyboard.q", 81);
addKey(KEYSYM, "key.keyboard.r", 82);
addKey(KEYSYM, "key.keyboard.s", 83);
addKey(KEYSYM, "key.keyboard.t", 84);
addKey(KEYSYM, "key.keyboard.u", 85);
addKey(KEYSYM, "key.keyboard.v", 86);
addKey(KEYSYM, "key.keyboard.w", 87);
addKey(KEYSYM, "key.keyboard.x", 88);
addKey(KEYSYM, "key.keyboard.y", 89);
addKey(KEYSYM, "key.keyboard.z", 90);
addKey(KEYSYM, "key.keyboard.f1", 290);
addKey(KEYSYM, "key.keyboard.f2", 291);
addKey(KEYSYM, "key.keyboard.f3", 292);
addKey(KEYSYM, "key.keyboard.f4", 293);
addKey(KEYSYM, "key.keyboard.f5", 294);
addKey(KEYSYM, "key.keyboard.f6", 295);
addKey(KEYSYM, "key.keyboard.f7", 296);
addKey(KEYSYM, "key.keyboard.f8", 297);
addKey(KEYSYM, "key.keyboard.f9", 298);
addKey(KEYSYM, "key.keyboard.f10", 299);
addKey(KEYSYM, "key.keyboard.f11", 300);
addKey(KEYSYM, "key.keyboard.f12", 301);
addKey(KEYSYM, "key.keyboard.f13", 302);
addKey(KEYSYM, "key.keyboard.f14", 303);
addKey(KEYSYM, "key.keyboard.f15", 304);
addKey(KEYSYM, "key.keyboard.f16", 305);
addKey(KEYSYM, "key.keyboard.f17", 306);
addKey(KEYSYM, "key.keyboard.f18", 307);
addKey(KEYSYM, "key.keyboard.f19", 308);
addKey(KEYSYM, "key.keyboard.f20", 309);
addKey(KEYSYM, "key.keyboard.f21", 310);
addKey(KEYSYM, "key.keyboard.f22", 311);
addKey(KEYSYM, "key.keyboard.f23", 312);
addKey(KEYSYM, "key.keyboard.f24", 313);
addKey(KEYSYM, "key.keyboard.f25", 314);
addKey(KEYSYM, "key.keyboard.num.lock", 282);
addKey(KEYSYM, "key.keyboard.keypad.0", 320);
addKey(KEYSYM, "key.keyboard.keypad.1", 321);
addKey(KEYSYM, "key.keyboard.keypad.2", 322);
addKey(KEYSYM, "key.keyboard.keypad.3", 323);
addKey(KEYSYM, "key.keyboard.keypad.4", 324);
addKey(KEYSYM, "key.keyboard.keypad.5", 325);
addKey(KEYSYM, "key.keyboard.keypad.6", 326);
addKey(KEYSYM, "key.keyboard.keypad.7", 327);
addKey(KEYSYM, "key.keyboard.keypad.8", 328);
addKey(KEYSYM, "key.keyboard.keypad.9", 329);
addKey(KEYSYM, "key.keyboard.keypad.add", 334);
addKey(KEYSYM, "key.keyboard.keypad.decimal", 330);
addKey(KEYSYM, "key.keyboard.keypad.enter", 335);
addKey(KEYSYM, "key.keyboard.keypad.equal", 336);
addKey(KEYSYM, "key.keyboard.keypad.multiply", 332);
addKey(KEYSYM, "key.keyboard.keypad.divide", 331);
addKey(KEYSYM, "key.keyboard.keypad.subtract", 333);
addKey(KEYSYM, "key.keyboard.down", 264);
addKey(KEYSYM, "key.keyboard.left", 263);
addKey(KEYSYM, "key.keyboard.right", 262);
addKey(KEYSYM, "key.keyboard.up", 265);
addKey(KEYSYM, "key.keyboard.apostrophe", 39);
addKey(KEYSYM, "key.keyboard.backslash", 92);
addKey(KEYSYM, "key.keyboard.comma", 44);
addKey(KEYSYM, "key.keyboard.equal", 61);
addKey(KEYSYM, "key.keyboard.grave.accent", 96);
addKey(KEYSYM, "key.keyboard.left.bracket", 91);
addKey(KEYSYM, "key.keyboard.minus", 45);
addKey(KEYSYM, "key.keyboard.period", 46);
addKey(KEYSYM, "key.keyboard.right.bracket", 93);
addKey(KEYSYM, "key.keyboard.semicolon", 59);
addKey(KEYSYM, "key.keyboard.slash", 47);
addKey(KEYSYM, "key.keyboard.space", 32);
addKey(KEYSYM, "key.keyboard.tab", 258);
addKey(KEYSYM, "key.keyboard.left.alt", 342);
addKey(KEYSYM, "key.keyboard.left.control", 341);
addKey(KEYSYM, "key.keyboard.left.shift", 340);
addKey(KEYSYM, "key.keyboard.left.win", 343);
addKey(KEYSYM, "key.keyboard.right.alt", 346);
addKey(KEYSYM, "key.keyboard.right.control", 345);
addKey(KEYSYM, "key.keyboard.right.shift", 344);
addKey(KEYSYM, "key.keyboard.right.win", 347);
addKey(KEYSYM, "key.keyboard.enter", 257);
addKey(KEYSYM, "key.keyboard.escape", 256);
addKey(KEYSYM, "key.keyboard.backspace", 259);
addKey(KEYSYM, "key.keyboard.delete", 261);
addKey(KEYSYM, "key.keyboard.end", 269);
addKey(KEYSYM, "key.keyboard.home", 268);
addKey(KEYSYM, "key.keyboard.insert", 260);
addKey(KEYSYM, "key.keyboard.page.down", 267);
addKey(KEYSYM, "key.keyboard.page.up", 266);
addKey(KEYSYM, "key.keyboard.caps.lock", 280);
addKey(KEYSYM, "key.keyboard.pause", 284);
addKey(KEYSYM, "key.keyboard.scroll.lock", 281);
addKey(KEYSYM, "key.keyboard.menu", 348);
addKey(KEYSYM, "key.keyboard.print.screen", 283);
addKey(KEYSYM, "key.keyboard.world.1", 161);
addKey(KEYSYM, "key.keyboard.world.2", 162);
}
}
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE})
@OnlyIn(Dist.CLIENT)
public @interface Value {
}
}