You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property `InputEventKey.location`, which indicates the left/right location of key events which may come from one of two physical keys, eg. Shift, Ctrl. It also adds simulation of missing Shift KEYUP events for Windows. When multiple Shifts are held down at the same time, Windows natively only sends a KEYUP for the last one to be released.
This commit is contained in:
@@ -38,3 +38,12 @@ Key godot_code_from_android_code(unsigned int p_code) {
|
||||
}
|
||||
return Key::UNKNOWN;
|
||||
}
|
||||
|
||||
KeyLocation godot_location_from_android_code(unsigned int p_code) {
|
||||
for (int i = 0; android_godot_location_pairs[i].android_code != AKEYCODE_MAX; i++) {
|
||||
if (android_godot_location_pairs[i].android_code == p_code) {
|
||||
return android_godot_location_pairs[i].godot_code;
|
||||
}
|
||||
}
|
||||
return KeyLocation::UNSPECIFIED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user