mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
mobile/ebitenmobileview: Android: include keypress runes even for unmapped keys. (#2685)
Note that this is a theoretical bug - I do not have a keyboard I can reproduce this. However, if I remove a key from genkeys.go, pressing that key will, after this change, still emit its character to AppendInputChars. Thus, this better supports "odd" international keyboards. Also, make the updateInput calls more consistent - always one call per event. This should change no behavior, but should be more debuggable. Closes #2684
This commit is contained in:
parent
ede787c228
commit
1a9bff390d
@ -142,12 +142,12 @@ func OnKeyDownOnAndroid(keyCode int, unicodeChar int, source int, deviceID int)
|
||||
case source&sourceKeyboard == sourceKeyboard:
|
||||
if key, ok := androidKeyToUIKey[keyCode]; ok {
|
||||
keys[key] = struct{}{}
|
||||
var runes []rune
|
||||
if r := rune(unicodeChar); r != 0 && unicode.IsPrint(r) {
|
||||
runes = []rune{r}
|
||||
}
|
||||
updateInput(runes)
|
||||
}
|
||||
var runes []rune
|
||||
if r := rune(unicodeChar); r != 0 && unicode.IsPrint(r) {
|
||||
runes = []rune{r}
|
||||
}
|
||||
updateInput(runes)
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,8 +163,8 @@ func OnKeyUpOnAndroid(keyCode int, source int, deviceID int) {
|
||||
case source&sourceKeyboard == sourceKeyboard:
|
||||
if key, ok := androidKeyToUIKey[keyCode]; ok {
|
||||
delete(keys, key)
|
||||
updateInput(nil)
|
||||
}
|
||||
updateInput(nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user