public static class InputEvent.KeyInputEvent extends InputEvent
InputEvent.ClickInputEvent, InputEvent.KeyInputEvent, InputEvent.MouseInputEvent, InputEvent.MouseScrollEvent, InputEvent.RawMouseEvent
Modifier and Type | Field and Description |
---|---|
private int |
action |
private int |
key |
private int |
modifiers |
private int |
scanCode |
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.
|
private final int key
private final int scanCode
private final int action
private final int modifiers
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