You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to https://libgdx.com/wiki/misc/adding-new-keycodes, the keycodes used by libGDX should be the same as in Android's KeyEvent class. However, this is not the case of the two Control (Ctrl) keys.
CONTROL_LEFT and CONTROL_RIGHT are defined as 129 and 130, respectively. However, Android's KeyEvent class uses different values. As we can see in https://developer.android.com/reference/android/view/KeyEvent, the values for KEYCODE_CTRL_LEFT and KEYCODE_CTRL_RIGHT are 113 and 114. For this reason, Gdx.input.isKeyPressed(Keys.CONTROL_LEFT) and Gdx.input.isKeyPressed(Keys.CONTROL_RIGHT) do not work correctly on Android, although these work correctly on desktop due to the method getGdxKeyCode() in the class DefaultLwjgl3Input.
Reproduction steps/code
A simple program that handles keyboard events by displaying the keycodes is enough. The problem can be noticed when connecting a USB keyboard to an Android phone (with the help of a USB to USB Mini adapter if necessary) and pressing any of the two Ctrl keys. The displayed keycodes will be different depending on whether the program is running on Android or desktop.
Version of libGDX and/or relevant dependencies
1.12.0
Please select the affected platforms
Android
iOS
HTML/GWT
Windows
Linux
macOS
The text was updated successfully, but these errors were encountered:
Issue details
According to https://libgdx.com/wiki/misc/adding-new-keycodes, the keycodes used by libGDX should be the same as in Android's
KeyEvent
class. However, this is not the case of the two Control (Ctrl) keys.As seen in
libgdx/gdx/src/com/badlogic/gdx/Input.java
Lines 180 to 181 in 75612da
CONTROL_LEFT
andCONTROL_RIGHT
are defined as129
and130
, respectively. However, Android'sKeyEvent
class uses different values. As we can see in https://developer.android.com/reference/android/view/KeyEvent, the values forKEYCODE_CTRL_LEFT
andKEYCODE_CTRL_RIGHT
are113
and114
. For this reason,Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)
andGdx.input.isKeyPressed(Keys.CONTROL_RIGHT)
do not work correctly on Android, although these work correctly on desktop due to the methodgetGdxKeyCode()
in the classDefaultLwjgl3Input
.Reproduction steps/code
A simple program that handles keyboard events by displaying the keycodes is enough. The problem can be noticed when connecting a USB keyboard to an Android phone (with the help of a USB to USB Mini adapter if necessary) and pressing any of the two Ctrl keys. The displayed keycodes will be different depending on whether the program is running on Android or desktop.
Version of libGDX and/or relevant dependencies
1.12.0
Please select the affected platforms
The text was updated successfully, but these errors were encountered: