diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-29 13:15:42 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-29 13:15:42 +0100 |
commit | f220d46cdccb15f1aa141cd89c9dacee85b1b6ec (patch) | |
tree | bd02a89eb9942b5e6e6b54335ad750661502bc86 /platform/android/android_keys_utils.h | |
parent | 17e7f85c06366b427e5068c5b3e2940e27ff5f1d (diff) | |
parent | 8406e60522bb8d09649193be43c1c819edc1d059 (diff) | |
download | redot-engine-f220d46cdccb15f1aa141cd89c9dacee85b1b6ec.tar.gz |
Merge pull request #80231 from romlok/input-key-location
Support detecting and mapping ctrl/alt/shift/meta by their left/right physical location
Diffstat (limited to 'platform/android/android_keys_utils.h')
-rw-r--r-- | platform/android/android_keys_utils.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/platform/android/android_keys_utils.h b/platform/android/android_keys_utils.h index 5cf5628a8b..77c0911f2b 100644 --- a/platform/android/android_keys_utils.h +++ b/platform/android/android_keys_utils.h @@ -177,4 +177,24 @@ static AndroidGodotCodePair android_godot_code_pairs[] = { Key godot_code_from_android_code(unsigned int p_code); +// Key location determination. +struct AndroidGodotLocationPair { + unsigned int android_code = 0; + KeyLocation godot_code = KeyLocation::UNSPECIFIED; +}; + +static AndroidGodotLocationPair android_godot_location_pairs[] = { + { AKEYCODE_ALT_LEFT, KeyLocation::LEFT }, + { AKEYCODE_ALT_RIGHT, KeyLocation::RIGHT }, + { AKEYCODE_SHIFT_LEFT, KeyLocation::LEFT }, + { AKEYCODE_SHIFT_RIGHT, KeyLocation::RIGHT }, + { AKEYCODE_CTRL_LEFT, KeyLocation::LEFT }, + { AKEYCODE_CTRL_RIGHT, KeyLocation::RIGHT }, + { AKEYCODE_META_LEFT, KeyLocation::LEFT }, + { AKEYCODE_META_RIGHT, KeyLocation::RIGHT }, + { AKEYCODE_MAX, KeyLocation::UNSPECIFIED } +}; + +KeyLocation godot_location_from_android_code(unsigned int p_code); + #endif // ANDROID_KEYS_UTILS_H |