https://kotlinlang.org logo
#korge
Title
# korge
t

tobsef

06/16/2020, 10:21 PM
🪲 My game also uses keyboard controls. It seems the key handling changed during one of the last updates. Both, the number 1 and the numpad 1 are mapped to the same N1 enum. So it's not possible to detect key events of the normal numbers.
Copy code
stage.onKeyDown {
   log.debug { "Pressed key: $it.key" }
}
| It's always
N1
for Numpad and normal numbers But it should also return
KP_1
. This is the behavior if numlock is enabled. If it's disabled, the numpad keys are mapped to the arrows DOWN, UP, LEFT & RIGHT
d

Deactivated User

06/17/2020, 7:08 PM
Which target?
t

tobsef

06/17/2020, 11:08 PM
It happens on JS and JVM. SImple test: Add one of these three vairants to the
onKeyDown
action: when (key) { Key.N1 -> println("Keyboard 1 & Numpad 1") } when (key) { Key.NUMPAD1 -> println("Keyboard 1 & Numpad 1") } when (key) { Key.KP_1 -> println("No Keyboard & No Numpad") }
👍 1
2 Views