public static class InputEvent.KeyInputEvent extends InputEvent
InputEvent.KeyInputEvent, InputEvent.MouseInputEvent, InputEvent.MouseScrollEvent, InputEvent.RawMouseEvent
Constructor and Description |
---|
KeyInputEvent(int key,
int scanCode,
int action,
int modifiers) |
Modifier and Type | Method and Description |
---|---|
int |
getAction()
Integer representing the key's action.
|
int |
getKey()
The keyboard key that triggered this event.
|
int |
getModifiers()
Bit field representing the modifier keys pressed.
|
int |
getScanCode()
Platform-specific scan code.
|
public KeyInputEvent(int key, int scanCode, int action, int modifiers)
public int getKey()
key constants starting with "GLFW_KEY_"
public int getScanCode()
InputMappings.getInputByCode(int, int)
The scan code is unique for every key, regardless of whether it has a key code.
Scan codes are platform-specific but consistent over time, so keys will have different scan codes depending
on the platform but they are safe to save to disk as custom key bindings.public int getAction()
GLFW.GLFW_PRESS
,
GLFW.GLFW_RELEASE
,
GLFW.GLFW_REPEAT
public int getModifiers()
GLFW.GLFW_MOD_SHIFT
,
GLFW.GLFW_MOD_CONTROL
,
GLFW.GLFW_MOD_ALT
,
GLFW.GLFW_MOD_SUPER